Documentation ¶
Overview ¶
Package api provides a client for Glass Factory public APIs
Index ¶
- func DecodeResponse(target interface{}, res *http.Response) error
- func NewClient(ctx context.Context, settings *Settings) (*http.Client, string, error)
- type AuthTransport
- type ClientDetailsCall
- type ClientDetailsResponse
- type ClientListCall
- type ClientListResponse
- type ClientService
- type MemberDetailsCall
- type MemberDetailsResponse
- type MemberListCall
- type MemberListResponse
- type MemberReportsService
- func (r *MemberReportsService) GetTimeReportsBetweenDates(userID int, start time.Time, end time.Time, opts ...TimeReportOption) ([]*model.MemberTimeReport, error)
- func (r *MemberReportsService) TimeReport(userID int, start time.Time, end time.Time, opts ...TimeReportOption) *MemberTimeReportCall
- func (r *MemberReportsService) TimeReportsBetweenDates(userID int, start time.Time, end time.Time, opts ...TimeReportOption) *MemberTimeReportCalls
- type MemberService
- func (r *MemberService) Active(opts ...RequestOption) ([]*model.Member, error)
- func (r *MemberService) All(opts ...RequestOption) ([]*model.Member, error)
- func (r *MemberService) Details(userID int) *MemberDetailsCall
- func (r *MemberService) FindByEmail(email string, opts ...RequestOption) (*model.Member, error)deprecated
- func (r *MemberService) Get(userID int, opts ...RequestOption) (*model.Member, error)
- func (r *MemberService) GetActive(opts ...RequestOption) ([]*model.Member, error)deprecated
- func (r *MemberService) List(opts ...RequestOption) *MemberListCall
- func (r *MemberService) ListActive() *MemberListCalldeprecated
- func (r *MemberService) ListArchived() *MemberListCalldeprecated
- func (r *MemberService) SearchActive(term string) *MemberListCalldeprecated
- type MemberTimeReportCall
- type MemberTimeReportCalls
- type MemberTimeReportResponse
- type ProjectDetailsCall
- type ProjectDetailsResponse
- type ProjectListCall
- type ProjectListResponse
- type ProjectService
- func (r *ProjectService) All(opts ...RequestOption) ([]*model.Project, error)
- func (r *ProjectService) Details(projectID int) *ProjectDetailsCall
- func (r *ProjectService) Get(projectID int, opts ...RequestOption) (*model.Project, error)
- func (r *ProjectService) List(opts ...RequestOption) *ProjectListCall
- type RequestOption
- type RequestOptions
- type Service
- type Settings
- type TimeReportOption
- type TimeReportOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeResponse ¶
DecodeResponse decodes the body of res into target. If there is no body, target is unchanged.
Types ¶
type AuthTransport ¶
AuthTransport for the HTTP client provides the custom authentication headers
type ClientDetailsCall ¶
type ClientDetailsCall struct {
// contains filtered or unexported fields
}
ClientDetailsCall represents a request to Client Details API
func (*ClientDetailsCall) Do ¶
func (c *ClientDetailsCall) Do() (*ClientDetailsResponse, error)
Do executes the request and parses results
type ClientDetailsResponse ¶
ClientDetailsResponse represents a response from Client Details API
type ClientListCall ¶
type ClientListCall struct {
// contains filtered or unexported fields
}
ClientListCall represents a request to List Account's Clients API
func (*ClientListCall) Do ¶
func (c *ClientListCall) Do() (*ClientListResponse, error)
Do executes the request and parses results
func (*ClientListCall) Options ¶
func (c *ClientListCall) Options() RequestOptions
Options returns request options with defaults
type ClientListResponse ¶
ClientListResponse represents a response from List Account's Clients API
type ClientService ¶
type ClientService struct {
// contains filtered or unexported fields
}
ClientService is used for calling the Glass Factory client APIs
func NewClientService ¶
func NewClientService(s *Service) *ClientService
NewClientService initialises a new ClientService
func (*ClientService) All ¶
func (r *ClientService) All(opts ...RequestOption) ([]*model.Client, error)
All returns all clients in the Glass Factory account
func (*ClientService) Details ¶
func (r *ClientService) Details(clientID int) *ClientDetailsCall
Details returns client details from Glass Factory
func (*ClientService) Get ¶
func (r *ClientService) Get(clientID int, opts ...RequestOption) (*model.Client, error)
Get returns a client from Glass Factory
func (*ClientService) List ¶
func (r *ClientService) List(opts ...RequestOption) *ClientListCall
List returns a list of clients in the Glass Factory account
type MemberDetailsCall ¶
type MemberDetailsCall struct {
// contains filtered or unexported fields
}
MemberDetailsCall represents a request to Member Details API
func (*MemberDetailsCall) Do ¶
func (c *MemberDetailsCall) Do() (*MemberDetailsResponse, error)
Do executes the request and parses results
type MemberDetailsResponse ¶
MemberDetailsResponse represents a response from Member Details API
type MemberListCall ¶
type MemberListCall struct {
// contains filtered or unexported fields
}
MemberListCall represents a request to List Staff Members API
func (*MemberListCall) Do ¶
func (c *MemberListCall) Do() (*MemberListResponse, error)
Do executes the request and parses results
func (*MemberListCall) Options ¶
func (c *MemberListCall) Options() RequestOptions
Options returns request options with defaults
type MemberListResponse ¶
MemberListResponse represents a response from List Staff Members API
type MemberReportsService ¶
type MemberReportsService struct {
// contains filtered or unexported fields
}
MemberReportsService provides methods for fetching time report data from Glass Factory
func NewMemberReportsService ¶
func NewMemberReportsService(m *MemberService) *MemberReportsService
NewMemberReportsService creates a new MemberReportsService
func (*MemberReportsService) GetTimeReportsBetweenDates ¶
func (r *MemberReportsService) GetTimeReportsBetweenDates(userID int, start time.Time, end time.Time, opts ...TimeReportOption) ([]*model.MemberTimeReport, error)
GetTimeReportsBetweenDates returns Glass Factory member time reports between given dates
func (*MemberReportsService) TimeReport ¶
func (r *MemberReportsService) TimeReport(userID int, start time.Time, end time.Time, opts ...TimeReportOption) *MemberTimeReportCall
TimeReport queries Glass Factory and returns member time reports for the given time period
func (*MemberReportsService) TimeReportsBetweenDates ¶
func (r *MemberReportsService) TimeReportsBetweenDates(userID int, start time.Time, end time.Time, opts ...TimeReportOption) *MemberTimeReportCalls
TimeReportsBetweenDates creates MemberTimeReportCalls to be used for fetching member time reports between the given dates
type MemberService ¶
type MemberService struct { Reports *MemberReportsService // contains filtered or unexported fields }
MemberService is used for calling the Glass Factory member APIs
func NewMemberService ¶
func NewMemberService(s *Service) *MemberService
NewMemberService initialises a new MemberService
func (*MemberService) Active ¶
func (r *MemberService) Active(opts ...RequestOption) ([]*model.Member, error)
Active returns all active members in the Glass Factory account
func (*MemberService) All ¶
func (r *MemberService) All(opts ...RequestOption) ([]*model.Member, error)
All returns all members in the Glass Factory account
func (*MemberService) Details ¶
func (r *MemberService) Details(userID int) *MemberDetailsCall
Details returns member details from Glass Factory
func (*MemberService) FindByEmail
deprecated
func (r *MemberService) FindByEmail(email string, opts ...RequestOption) (*model.Member, error)
FindByEmail lists all members in the Glass Factory account and looks for a member with matching email address.
Deprecated: Filter members outside the service.
func (*MemberService) Get ¶
func (r *MemberService) Get(userID int, opts ...RequestOption) (*model.Member, error)
Get returns a member from Glass Factory by their user ID
func (*MemberService) GetActive
deprecated
func (r *MemberService) GetActive(opts ...RequestOption) ([]*model.Member, error)
GetActive returns all active members in the Glass Factory account
Deprecated: Use MemberService.Active()
func (*MemberService) List ¶
func (r *MemberService) List(opts ...RequestOption) *MemberListCall
List returns a list of staff members in the Glass Factory account
func (*MemberService) ListActive
deprecated
func (r *MemberService) ListActive() *MemberListCall
ListActive returns a list of active staff members in the Glass Factory account
Deprecated: You should call MemberService.List(WithStatus("active")) instead.
func (*MemberService) ListArchived
deprecated
func (r *MemberService) ListArchived() *MemberListCall
ListArchived returns a list of archived staff members in the Glass Factory account
Deprecated: You should call MemberService.List(WithStatus("archived")) instead.
func (*MemberService) SearchActive
deprecated
func (r *MemberService) SearchActive(term string) *MemberListCall
SearchActive returns a list of active users matching the search term.
Deprecated: You should call MemberService.List() directly with WithTerm(term) and WithStatus("active")) options instead.
type MemberTimeReportCall ¶
type MemberTimeReportCall struct {
// contains filtered or unexported fields
}
MemberTimeReportCall is used for fetching time reports for given time period from Glass Factory
func (*MemberTimeReportCall) Do ¶
func (c *MemberTimeReportCall) Do() (*MemberTimeReportResponse, error)
Do executes the MemberTimeReportCall and returns MemberTimeReportResponse with the time report data
func (*MemberTimeReportCall) Options ¶
func (c *MemberTimeReportCall) Options() TimeReportOptions
Options returns request options with defaults
type MemberTimeReportCalls ¶
type MemberTimeReportCalls struct {
// contains filtered or unexported fields
}
MemberTimeReportCalls is used for fetching multiple time reports from Glass Factory
func (*MemberTimeReportCalls) Append ¶
func (m *MemberTimeReportCalls) Append(c *MemberTimeReportCall)
Append additional MemberTimeReportCall to the list of calls
func (*MemberTimeReportCalls) Do ¶
func (m *MemberTimeReportCalls) Do() ([]*MemberTimeReportResponse, error)
Do executes all the queries in MemberTimeReportCalls
type MemberTimeReportResponse ¶
type MemberTimeReportResponse struct {
Reports []*model.MemberTimeReport
}
MemberTimeReportResponse contains the time reports returned from Glass Factory
type ProjectDetailsCall ¶
type ProjectDetailsCall struct {
// contains filtered or unexported fields
}
ProjectDetailsCall represents a request to Project Details API
func (*ProjectDetailsCall) Do ¶
func (c *ProjectDetailsCall) Do() (*ProjectDetailsResponse, error)
Do executes the request and parses results
type ProjectDetailsResponse ¶
ProjectDetailsResponse represents a response from Project Details API
type ProjectListCall ¶
type ProjectListCall struct {
// contains filtered or unexported fields
}
ProjectListCall represents a request to List Account's PRojects API
func (*ProjectListCall) Do ¶
func (c *ProjectListCall) Do() (*ProjectListResponse, error)
Do executes the request and parses results
func (*ProjectListCall) Options ¶
func (c *ProjectListCall) Options() RequestOptions
Options returns request options with defaults
type ProjectListResponse ¶
ProjectListResponse represents a response from List Account's PRojects API
type ProjectService ¶
type ProjectService struct {
// contains filtered or unexported fields
}
ProjectService is used for calling the Glass Factory project APIs
func NewProjectService ¶
func NewProjectService(s *Service) *ProjectService
NewProjectService initialises a new ProjectService
func (*ProjectService) All ¶
func (r *ProjectService) All(opts ...RequestOption) ([]*model.Project, error)
All returns all projects in the Glass Factory account
func (*ProjectService) Details ¶
func (r *ProjectService) Details(projectID int) *ProjectDetailsCall
Details returns project details from Glass Factory
func (*ProjectService) Get ¶
func (r *ProjectService) Get(projectID int, opts ...RequestOption) (*model.Project, error)
Get returns a project from Glass Factory
func (*ProjectService) List ¶
func (r *ProjectService) List(opts ...RequestOption) *ProjectListCall
List returns a list of projects in the Glass Factory account
type RequestOption ¶
type RequestOption interface {
// contains filtered or unexported methods
}
RequestOption overrides behavior of the service requests
func WithStatus ¶
func WithStatus(status string) RequestOption
WithStatus returns requests matching given status
func WithTerm ¶
func WithTerm(term string) RequestOption
WithTerm returns requests matching the search term
type RequestOptions ¶
type RequestOptions struct {
// contains filtered or unexported fields
}
RequestOptions represent the available options on the service requests
func NewRequestOptions ¶
func NewRequestOptions(opts []RequestOption) *RequestOptions
NewRequestOptions returns RequestOptions with defaults
type Service ¶
type Service struct { BasePath string // Base URL for the API Client *ClientService Member *MemberService Project *ProjectService // contains filtered or unexported fields }
Service is used for calling Glass Factory APIs
func NewService ¶
NewService creates a new Service.
type Settings ¶
Settings for the HTTP client
func NewSettings ¶
NewSettings creates new Settings for API authentication and validates them
type TimeReportOption ¶
type TimeReportOption interface {
// contains filtered or unexported methods
}
TimeReportOption overrides behavior of TimeReport
func FetchRelated ¶
func FetchRelated() TimeReportOption
FetchRelated fetches the related data into the results
func WithClient ¶
func WithClient(clientID int) TimeReportOption
WithClient returns time reports matching the given client
func WithOffice ¶
func WithOffice(officeID int) TimeReportOption
WithOffice returns time reports matching the given office
func WithProject ¶
func WithProject(projectID int) TimeReportOption
WithProject returns time reports matching the given project
func WithProjects ¶
func WithProjects(projectIDs []int) TimeReportOption
WithProjects returns time reports matching the given projects
type TimeReportOptions ¶
type TimeReportOptions struct {
// contains filtered or unexported fields
}
TimeReportOptions represent the options that can be used when generating member time reports
func NewTimeReportOptions ¶
func NewTimeReportOptions(opts []TimeReportOption) *TimeReportOptions
NewTimeReportOptions returns TimeReportOptions with defaults