Documentation ¶
Index ¶
- Variables
- func CacheExpires(r *http.Response) time.Time
- type APIClient
- type APIKey
- type APIResponse
- type BasicAuth
- type Configuration
- type Entry
- type GenericOpenAPIError
- type GetAllKPIEntriesOpts
- type KPIEntriesApiService
- func (a *KPIEntriesApiService) AddKPIEntry(ctx context.Context, kpiEntry KpiEntry) (KpiEntry, *http.Response, error)
- func (a *KPIEntriesApiService) DeleteKPIEntry(ctx context.Context, kpientryid int64) (*http.Response, error)
- func (a *KPIEntriesApiService) GetAllKPIEntries(ctx context.Context, dateFrom string, dateTo string, ...) ([]KpiEntry, *http.Response, error)
- func (a *KPIEntriesApiService) GetKPIEntry(ctx context.Context, kpientryid int64) (KpiEntry, *http.Response, error)
- func (a *KPIEntriesApiService) UpdateKPIEntry(ctx context.Context, kpientryid int64, kpiEntry KpiEntry) (KpiEntry, *http.Response, error)
- type KPIsApiService
- type Kpi
- type KpiEntry
- type User
- type UsersApiService
Constants ¶
This section is empty.
Variables ¶
var ( // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the request. ContextBasicAuth = contextKey("basic") // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") )
Functions ¶
Types ¶
type APIClient ¶
type APIClient struct { KPIEntriesApi *KPIEntriesApiService KPIsApi *KPIsApiService UsersApi *UsersApiService // contains filtered or unexported fields }
APIClient manages communication with the SimpleKPI API API v1.0 In most cases there should be only one, shared, APIClient.
func NewAPIClient ¶
func NewAPIClient(cfg *Configuration) *APIClient
NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.
func (*APIClient) ChangeBasePath ¶
Change base path to allow switching to mocks
func (*APIClient) HTTPClient ¶
type APIKey ¶
APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIResponse ¶
type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` // Operation is the name of the OpenAPI operation. Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. Payload []byte `json:"-"` }
func NewAPIResponse ¶
func NewAPIResponse(r *http.Response) *APIResponse
func NewAPIResponseWithError ¶
func NewAPIResponseWithError(errorMessage string) *APIResponse
type BasicAuth ¶
type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` }
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
type Configuration ¶
type Configuration struct { BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` HTTPClient *http.Client }
func NewConfiguration ¶
func NewConfiguration() *Configuration
func (*Configuration) AddDefaultHeader ¶
func (c *Configuration) AddDefaultHeader(key string, value string)
type Entry ¶
type Entry struct { Actual float64 `json:"actual,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` EntryDate time.Time `json:"entry_date,omitempty"` Id int64 `json:"id,omitempty"` KpiId int64 `json:"kpi_id,omitempty"` Notes string `json:"notes,omitempty"` Target float64 `json:"target,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` UserId int64 `json:"user_id,omitempty"` }
type GenericOpenAPIError ¶
type GenericOpenAPIError struct {
// contains filtered or unexported fields
}
GenericOpenAPIError Provides access to the body, error and model on returned errors.
func (GenericOpenAPIError) Body ¶
func (e GenericOpenAPIError) Body() []byte
Body returns the raw bytes of the response
func (GenericOpenAPIError) Error ¶
func (e GenericOpenAPIError) Error() string
Error returns non-empty string if there was an error.
func (GenericOpenAPIError) Model ¶
func (e GenericOpenAPIError) Model() interface{}
Model returns the unpacked model of the error
type GetAllKPIEntriesOpts ¶
type KPIEntriesApiService ¶
type KPIEntriesApiService service
func (*KPIEntriesApiService) AddKPIEntry ¶
func (a *KPIEntriesApiService) AddKPIEntry(ctx context.Context, kpiEntry KpiEntry) (KpiEntry, *http.Response, error)
KPIEntriesApiService Add KPI Entry The KPI entries are filtered based on the search query string. All the search criteria is optional and we will return a maximum of 500 entries per page. If the result set has the amount of rows you set `&rows=100`, it's your responsibility to check the next page to see if there are any more -- you do this by adding &page=2 to the query, then &page=3 and so on.
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param kpiEntry KPI Entry Object
@return KpiEntry
func (*KPIEntriesApiService) DeleteKPIEntry ¶
func (a *KPIEntriesApiService) DeleteKPIEntry(ctx context.Context, kpientryid int64) (*http.Response, error)
KPIEntriesApiService Delete KPI Entry
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param kpientryid
func (*KPIEntriesApiService) GetAllKPIEntries ¶
func (a *KPIEntriesApiService) GetAllKPIEntries(ctx context.Context, dateFrom string, dateTo string, localVarOptionals *GetAllKPIEntriesOpts) ([]KpiEntry, *http.Response, error)
func (*KPIEntriesApiService) GetKPIEntry ¶
func (a *KPIEntriesApiService) GetKPIEntry(ctx context.Context, kpientryid int64) (KpiEntry, *http.Response, error)
KPIEntriesApiService Get KPI Entry
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param kpientryid
@return KpiEntry
func (*KPIEntriesApiService) UpdateKPIEntry ¶
func (a *KPIEntriesApiService) UpdateKPIEntry(ctx context.Context, kpientryid int64, kpiEntry KpiEntry) (KpiEntry, *http.Response, error)
KPIEntriesApiService Update KPI Entry
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param kpientryid
- @param kpiEntry KPI Entry Object
@return KpiEntry
type KPIsApiService ¶
type KPIsApiService service
func (*KPIsApiService) GetAllKPIs ¶
KPIsApiService Get all KPIs Returns data on all KPIs. There are no parameters for this API.
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return []Kpi
type Kpi ¶
type Kpi struct { // The aggregate function determines how the KPI is calculated and can be either AVG (Average) or SUM (Total Sum) AggregateFunction string `json:"aggregate_function"` // The id of the category the KPI is in CategoryId int64 `json:"category_id"` // The UTC date and time the KPI was created. Date time format without timezone, e.g. `2019-01-01T00:00:00` CreatedAt string `json:"created_at,omitempty"` // The description of the KPI Description string `json:"description,omitempty"` FrequencyId string `json:"frequency_id"` // The id of the icon to assign to the KPI IconId int64 `json:"icon_id"` // Automatically generated for the KPI Id int64 `json:"id,omitempty"` // Active KPIs can have date entered against them otherwise they are display only KPIs IsActive bool `json:"is_active"` // Calculated KPIs cannot be amended via the API and must be added / amended in the interface IsCalculated bool `json:"is_calculated,omitempty"` // The name of the KPI Name string `json:"name"` // The display order of the KPI SortOrder int32 `json:"sort_order"` // The default target value for the KPI. If left blank or null the KPI will not have a target TargetDefault float32 `json:"target_default,omitempty"` // The id of the unit of measure to assign to the KPI UnitId int64 `json:"unit_id"` // The UTC date and time the KPI was updated. Date time format without timezone, e.g. `2019-01-01T00:00:00` UpdatedAt string `json:"updated_at,omitempty"` // The value direction is case sensitive and can only be U(p), D(own) and N(one) ValueDirection string `json:"value_direction"` }
type KpiEntry ¶
type KpiEntry struct { // The actual value cannot be null if the target and notes are both null Actual float64 `json:"actual,omitempty"` // The UTC date and time the KPI entry was created. Date time format without timezone, e.g. `2019-01-01T00:00:00` CreatedAt string `json:"created_at,omitempty"` // The date of the entry. Date time format without timezone, e.g. `2019-01-01T00:00:00` EntryDate string `json:"entry_date"` // Automatically generated for the KPI entry Id int64 `json:"id,omitempty"` // The kpi must be active and cannot be a calculated KPI. The KPI must also be assigned to the user KpiId int64 `json:"kpi_id"` // The note associated with the KPI entry Notes string `json:"notes,omitempty"` // The target value of the entry. This value will be ignored if the KPI has a null target Target float64 `json:"target,omitempty"` // The UTC date and time the KPI entry was updated. Date time format without timezone, e.g. `2019-01-01T00:00:00` UpdatedAt string `json:"updated_at,omitempty"` // An id of an active user to assign to the KPI entry UserId int64 `json:"user_id"` }
type User ¶
type User struct { CanAdminSettings bool `json:"can_admin_settings,omitempty"` CanManageUsers bool `json:"can_manage_users,omitempty"` CreatedAt string `json:"created_at,omitempty"` Email string `json:"email,omitempty"` FirstName string `json:"first_name,omitempty"` Id int64 `json:"id,omitempty"` LastLoginAt string `json:"last_login_at,omitempty"` LastName string `json:"last_name,omitempty"` LastPasswordChangedAt string `json:"last_password_changed_at,omitempty"` Password string `json:"password,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` UserStatusId string `json:"user_status_id,omitempty"` UserType string `json:"user_type,omitempty"` }
type UsersApiService ¶
type UsersApiService service
func (*UsersApiService) GetAllUsers ¶
UsersApiService Get all Users Returns data on all users. There are no parameters for this API.
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return []User