Documentation ¶
Overview ¶
Package cachet provides a client for using the Cachet API (https://cachethq.io/).
Construct a new Cachet client, then use the various services on the client to access different parts of the Cachet API. For example:
instance := "https://demo.cachethq.io/" client, err := cachet.NewClient(instance, nil) // Get all components components, resp, err := client.Components.GetAll()
The services of a client divide the API into logical chunks and correspond to the structure of the Cachet API documentation at https://docs.cachethq.io/docs/.
Authentication ¶
The cachet library supports various methods to support the authentication. This methods are combined in the AuthenticationService that is available at client.Authentication.
One way is an authentication via HTTP BasicAuth:
instance := "https://demo.cachethq.io/" client, err := cachet.NewClient(instance, nil) client.Authentication.SetBasicAuth("test@test.com", "test123") component := &cachet.Component{ Name: "Beer Fridge", Description: "Status of the beer fridge in the kitchen", Status: cachet.ComponentStatusOperational, } newComponent, resp, err := client.Components.Create(component) fmt.Printf("Result: %s\n", newComponent.Name) // Result: Beer Fridge
The other way is the API Token by Cachet:
instance := "https://demo.cachethq.io/" client, err := cachet.NewClient(instance, nil) client.Authentication.SetTokenAuth("MY-SECRET-TOKEN") // ... your action here
Additionally when creating a new client, pass an http.Client that supports further actions for you. For more information regarding authentication have a look at the Cachet documentation: https://docs.cachethq.io/docs/api-authentication
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- type AuthenticationService
- type Client
- type Component
- type ComponentGroup
- type ComponentGroupResponse
- type ComponentGroupsQueryParams
- type ComponentGroupsService
- func (s *ComponentGroupsService) Create(c *ComponentGroup) (*ComponentGroup, *Response, error)
- func (s *ComponentGroupsService) Delete(id int) (*Response, error)
- func (s *ComponentGroupsService) Get(id int) (*ComponentGroup, *Response, error)
- func (s *ComponentGroupsService) GetAll(filter *ComponentGroupsQueryParams) (*ComponentGroupResponse, *Response, error)
- func (s *ComponentGroupsService) Update(id int, c *ComponentGroup) (*ComponentGroup, *Response, error)
- type ComponentResponse
- type ComponentsQueryParams
- type ComponentsService
- func (s *ComponentsService) Create(c *Component) (*Component, *Response, error)
- func (s *ComponentsService) Delete(id int) (*Response, error)
- func (s *ComponentsService) Get(id int) (*Component, *Response, error)
- func (s *ComponentsService) GetAll(filter *ComponentsQueryParams) (*ComponentResponse, *Response, error)
- func (s *ComponentsService) Update(id int, c *Component) (*Component, *Response, error)
- type GeneralService
- type Incident
- type IncidentResponse
- type IncidentUpdate
- type IncidentUpdateResponse
- type IncidentUpdatesService
- func (s *IncidentUpdatesService) Create(incidentID int, i *IncidentUpdate) (*IncidentUpdate, *Response, error)
- func (s *IncidentUpdatesService) Delete(incidentID int, updateID int) (*Response, error)
- func (s *IncidentUpdatesService) Get(incidentID int, updateID int) (*IncidentUpdate, *Response, error)
- func (s *IncidentUpdatesService) GetAll(incidentID int) (*IncidentUpdateResponse, *Response, error)
- func (s *IncidentUpdatesService) Update(incidentID int, updateID int, i *IncidentUpdate) (*IncidentUpdate, *Response, error)
- type IncidentsQueryParams
- type IncidentsService
- func (s *IncidentsService) Create(i *Incident) (*Incident, *Response, error)
- func (s *IncidentsService) Delete(id int) (*Response, error)
- func (s *IncidentsService) Get(id int) (*Incident, *Response, error)
- func (s *IncidentsService) GetAll(filter *IncidentsQueryParams) (*IncidentResponse, *Response, error)
- func (s *IncidentsService) Update(id int, i *Incident) (*Incident, *Response, error)
- type Latest
- type Links
- type Meta
- type MetaVersion
- type Metric
- type MetricQueryParams
- type MetricResponse
- type MetricsService
- func (s *MetricsService) AddPoint(id int, value int, timestamp string) (*Point, *Response, error)
- func (s *MetricsService) Create(m *Metric) (*Metric, *Response, error)
- func (s *MetricsService) Delete(id int) (*Response, error)
- func (s *MetricsService) DeletePoint(id, pointID int) (*Response, error)
- func (s *MetricsService) Get(id int) (*Metric, *Response, error)
- func (s *MetricsService) GetAll(filter *MetricQueryParams) (*MetricResponse, *Response, error)
- func (s *MetricsService) GetPoints(id int) (*[]Point, *Response, error)
- type Pagination
- type PingResponse
- type Point
- type QueryOptions
- type Response
- type Schedule
- type ScheduleResponse
- type SchedulesQueryParams
- type SchedulesService
- func (s *SchedulesService) Create(i *Schedule) (*Schedule, *Response, error)
- func (s *SchedulesService) Delete(id int) (*Response, error)
- func (s *SchedulesService) Get(id int) (*Schedule, *Response, error)
- func (s *SchedulesService) GetAll(filter *SchedulesQueryParams) (*ScheduleResponse, *Response, error)
- func (s *SchedulesService) Update(id int, i *Schedule) (*Schedule, *Response, error)
- type SortOrdering
- type Status
- type StatusAPIResponse
- type Subscriber
- type SubscriberResponse
- type SubscribersQueryParams
- type SubscribersService
- type SubscriptionsService
- type Tags
- type VersionResponse
Examples ¶
Constants ¶
const ( // ComponentGroupVisibilityPublic means "Viewable by public" ComponentGroupVisibilityPublic = 1 // ComponentGroupVisibilityLoggedIn means "Only visible to logged in users" ComponentGroupVisibilityLoggedIn = 0 )
const ( // ComponentStatusUnknown means "The component's status is not known." ComponentStatusUnknown = 0 // ComponentStatusOperational means "The component is working." ComponentStatusOperational = 1 // ComponentStatusPerformanceIssues means "The component is experiencing some slowness." ComponentStatusPerformanceIssues = 2 // ComponentStatusPartialOutage means "The component may not be working for everybody." // This could be a geographical issue for example. ComponentStatusPartialOutage = 3 // ComponentStatusMajorOutage means "The component is not working for anybody." ComponentStatusMajorOutage = 4 )
const ( // IncidentStatusScheduled means "This status is used for a scheduled status." IncidentStatusScheduled = 0 // IncidentStatusInvestigating means "You have reports of a problem and you're currently looking into them." IncidentStatusInvestigating = 1 // IncidentStatusIdentified means "You've found the issue and you're working on a fix." IncidentStatusIdentified = 2 // IncidentStatusWatching means "You've since deployed a fix and you're currently watching the situation." IncidentStatusWatching = 3 // IncidentStatusFixed means "The fix has worked, you're happy to close the incident." IncidentStatusFixed = 4 // IncidentVisibilityPublic means "Viewable by public" IncidentVisibilityPublic = 1 // IncidentVisibilityLoggedIn means "Only visible to logged in users" IncidentVisibilityLoggedIn = 0 )
const ( // MetricsViewLastHour means "Default view: Last Hour" MetricsViewLastHour = 0 // MetricsViewLast12Hours means "Default view: Last 12 Hours" MetricsViewLast12Hours = 1 // MetricsViewLastWeek means "Default view: Week" MetricsViewLastWeek = 2 // MetricsViewLastMonth means "Default view: Month" MetricsViewLastMonth = 3 // MetricsCalculationSum means "Calculation of Metrics: Sum" MetricsCalculationSum = 0 // MetricsCalculationAverage means "Calculation of Metrics: Average" MetricsCalculationAverage = 1 // MetricsVisibilityLoggedIn means "Visibility: Visible to authenticated users" MetricsVisibilityLoggedIn = 0 // MetricsVisibilityPublic means "Visibility: Visible to everybody" MetricsVisibilityPublic = 1 // MetricsVisibilityHidden means "Visibility: Always hidden" MetricsVisibilityHidden = 2 // MetricsNoDisplayChart means to not display chart in Status Page MetricsNoDisplayChart = 0 // MetricsDisplayChart means to display chart in Status Page MetricsDisplayChart = 1 )
const ( // ScheduleUpcoming means "This scheduled event is going to happen somewhere in the future." ScheduleUpcoming = 0 // ScheduleInProgress means "This scheduled event is happening at the moment." ScheduleInProgress = 1 // ScheduleComplete means "This scheduled event has already finished." ScheduleComplete = 2 )
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range.
Types ¶
type AuthenticationService ¶
type AuthenticationService struct {
// contains filtered or unexported fields
}
AuthenticationService contains contains Authentication related functions.
func (*AuthenticationService) HasAuth ¶
func (s *AuthenticationService) HasAuth() bool
HasAuth checks if an auth type is used
func (*AuthenticationService) HasBasicAuth ¶
func (s *AuthenticationService) HasBasicAuth() bool
HasBasicAuth checks if the auth type is HTTP Basic auth
func (*AuthenticationService) HasTokenAuth ¶
func (s *AuthenticationService) HasTokenAuth() bool
HasTokenAuth checks we auth with an API token against the API
func (*AuthenticationService) SetBasicAuth ¶
func (s *AuthenticationService) SetBasicAuth(username, password string)
SetBasicAuth sets basic parameters for HTTP Basic auth. Attention! Basic Auth is no longer supported by Cachet since ~v2.1. You can only use this if you running an older version. Checkout https://github.com/CachetHQ/Cachet/issues/1658
func (*AuthenticationService) SetTokenAuth ¶
func (s *AuthenticationService) SetTokenAuth(token string)
SetTokenAuth sets the API token for "token auth"
type Client ¶
type Client struct { // Cachet service for authentication Authentication *AuthenticationService // Services used for talking to different parts of the Cachet API. General *GeneralService Components *ComponentsService ComponentGroups *ComponentGroupsService Incidents *IncidentsService IncidentUpdates *IncidentUpdatesService Metrics *MetricsService Schedules *SchedulesService Subscribers *SubscribersService Subscriptions *SubscriptionsService // contains filtered or unexported fields }
A Client manages communication with the Cachet API.
func NewClient ¶
NewClient returns a new Cachet API client. instance has to be the HTTP endpoint of the Cachet instance. If a nil httpClient is provided, http.DefaultClient will be used.
func (*Client) Call ¶
Call is a combine function for Client.NewRequest and Client.Do.
Most API methods are quite the same. Get the URL, apply options, make a request, and get the response. Without adding special headers or something. To avoid a big amount of code duplication you can Client.Call.
method is the HTTP method you want to call. u is the URL you want to call. body is the HTTP body. v is the HTTP response.
For more information read https://github.com/google/go-github/issues/234
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type Component ¶
type Component struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Link string `json:"link,omitempty"` Status int `json:"status,omitempty"` Order int `json:"order,omitempty"` Enabled bool `json:"enabled"` GroupID int `json:"group_id,omitempty"` CreatedAt string `json:"created_at,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` DeletedAt string `json:"deleted_at,omitempty"` StatusName string `json:"status_name,omitempty"` Tags Tags `json:"tags,omitempty"` }
Component entity reflects one single component
type ComponentGroup ¶
type ComponentGroup struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Order int `json:"order,omitempty"` Collapsed int `json:"collapsed,omitempty"` Visible int `json:"visible,omitempty"` CreatedAt string `json:"created_at,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` EnabledComponents []Component `json:"enabled_components,omitempty"` EnabledComponentsLowest []Component `json:"enabled_components_lowest,omitempty"` LowestHumanStatus string `json:"lowest_human_status,omitempty"` }
ComponentGroup entity reflects one single component group
type ComponentGroupResponse ¶
type ComponentGroupResponse struct { Meta Meta `json:"meta,omitempty"` ComponentGroups []ComponentGroup `json:"data,omitempty"` }
ComponentGroupResponse reflects the response of /components/groups call
type ComponentGroupsQueryParams ¶
type ComponentGroupsQueryParams struct { ID int `url:"id,omitempty"` Name string `url:"name,omitempty"` Order int `url:"order,omitempty"` Collapsed bool `url:"collapsed,omitempty"` Visible int `url:"visible,omitempty"` QueryOptions }
ComponentGroupsQueryParams contains fields to filter returned results
type ComponentGroupsService ¶
type ComponentGroupsService struct {
// contains filtered or unexported fields
}
ComponentGroupsService contains REST endpoints that belongs to cachet components.
func (*ComponentGroupsService) Create ¶
func (s *ComponentGroupsService) Create(c *ComponentGroup) (*ComponentGroup, *Response, error)
Create creates a new component group.
Docs: https://docs.cachethq.io/reference#post-componentgroups
func (*ComponentGroupsService) Delete ¶
func (s *ComponentGroupsService) Delete(id int) (*Response, error)
Delete deletes a component group.
Docs: https://docs.cachethq.io/reference#delete-component-group
func (*ComponentGroupsService) Get ¶
func (s *ComponentGroupsService) Get(id int) (*ComponentGroup, *Response, error)
Get return a single component group.
Docs: https://docs.cachethq.io/reference#get-a-component-group
func (*ComponentGroupsService) GetAll ¶
func (s *ComponentGroupsService) GetAll(filter *ComponentGroupsQueryParams) (*ComponentGroupResponse, *Response, error)
GetAll return all component groups that have been created.
Docs: https://docs.cachethq.io/reference#get-componentgroups
func (*ComponentGroupsService) Update ¶
func (s *ComponentGroupsService) Update(id int, c *ComponentGroup) (*ComponentGroup, *Response, error)
Update updates a component group.
Docs: https://docs.cachethq.io/reference#put-component-group
type ComponentResponse ¶
type ComponentResponse struct { Meta Meta `json:"meta,omitempty"` Components []Component `json:"data,omitempty"` }
ComponentResponse reflects the response of /components call
type ComponentsQueryParams ¶
type ComponentsQueryParams struct { ID int `url:"id,omitempty"` Name string `url:"name,omitempty"` Status int `url:"status,omitempty"` Order int `url:"order,omitempty"` Enabled bool `url:"enabled,omitempty"` GroupID int `url:"group_id,omitempty"` QueryOptions }
ComponentsQueryParams contains fields to filter returned results
type ComponentsService ¶
type ComponentsService struct {
// contains filtered or unexported fields
}
ComponentsService contains REST endpoints that belongs to cachet components.
func (*ComponentsService) Create ¶
func (s *ComponentsService) Create(c *Component) (*Component, *Response, error)
Create a new component.
func (*ComponentsService) Delete ¶
func (s *ComponentsService) Delete(id int) (*Response, error)
Delete deletes a component.
func (*ComponentsService) Get ¶
func (s *ComponentsService) Get(id int) (*Component, *Response, error)
Get return a single component.
Docs: https://docs.cachethq.io/reference#get-a-component
Example ¶
package main import ( "fmt" "github.com/kalidorob/cachet" ) func main() { client, err := cachet.NewClient("https://dev.cachethq.io/", nil) if err != nil { panic(err) } comp, resp, err := client.Components.Get(1) if err != nil { panic(resp) } fmt.Printf("Result: %s (ID: %d)\n", comp.Name, comp.ID) fmt.Printf("Status: %s\n", resp.Status) }
Output: Result: API (ID: 1) Status: 200 OK
func (*ComponentsService) GetAll ¶
func (s *ComponentsService) GetAll(filter *ComponentsQueryParams) (*ComponentResponse, *Response, error)
GetAll return all components that have been created.
type GeneralService ¶
type GeneralService struct {
// contains filtered or unexported fields
}
GeneralService contains REST endpoints that belongs no specific service.
func (*GeneralService) Ping ¶
func (s *GeneralService) Ping() (string, *Response, error)
Ping calls the API test endpoint.
Docs: https://docs.cachethq.io/reference#ping
Example ¶
package main import ( "fmt" "github.com/kalidorob/cachet" ) func main() { client, err := cachet.NewClient("https://dev.cachethq.io/", nil) if err != nil { panic(err) } pong, resp, err := client.General.Ping() if err != nil { panic(err) } fmt.Printf("Result: %s\n", pong) fmt.Printf("Status: %s\n", resp.Status) }
Output: Result: Pong! Status: 200 OK
func (*GeneralService) Status ¶
func (s *GeneralService) Status() (*Status, *Response, error)
Status get Cachet status
Docs: <none>
func (*GeneralService) Version ¶
func (s *GeneralService) Version() (*VersionResponse, *Response, error)
Version get Cachet version
type Incident ¶
type Incident struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Status int `json:"status,omitempty"` Message string `json:"message,omitempty"` Visible int `json:"visible,omitempty"` ComponentID int `json:"component_id,omitempty"` ComponentStatus int `json:"component_status,omitempty"` Notify bool `json:"notify,omitempty"` Stickied bool `json:"stickied,omitempty"` OccurredAt string `json:"occurred_at,omitempty"` Template string `json:"template,omitempty"` Vars []string `json:"vars,omitempty"` CreatedAt string `json:"created_at,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` DeletedAt string `json:"deleted_at,omitempty"` IsResolved bool `json:"is_resolved,omitempty"` Updates []IncidentUpdate `json:"updates,omitempty"` HumanStatus string `json:"human_status,omitempty"` LatestUpdateID int `json:"latest_update_id,omitempty"` LatestStatus int `json:"latest_status,omitempty"` LatestHumanStatus string `json:"latest_human_status,omitempty"` LatestIcon string `json:"latest_icon,omitempty"` Permalink string `json:"permalink,omitempty"` Duration int `json:"duration,omitempty"` }
Incident entity reflects one single incident
type IncidentResponse ¶
type IncidentResponse struct { Meta Meta `json:"meta,omitempty"` Incidents []Incident `json:"data,omitempty"` }
IncidentResponse reflects the response of /incidents call
type IncidentUpdate ¶
type IncidentUpdate struct { ID int `json:"id,omitempty"` IncidentID int `json:"incident_id,omitempty"` ComponentID int `json:"component_id,omitempty"` ComponentStatus int `json:"component_status,omitempty"` Status int `json:"status,omitempty"` Message string `json:"message,omitempty"` UserID int `json:"user_id,omitempty"` CreatedAt string `json:"created_at,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` HumanStatus string `json:"human_status,omitempty"` Permalink string `json:"permalink,omitempty"` }
IncidentUpdate entity reflects one single incident update
type IncidentUpdateResponse ¶
type IncidentUpdateResponse struct { Meta Meta `json:"meta,omitempty"` IncidentUpdates []IncidentUpdate `json:"data,omitempty"` }
IncidentUpdateResponse reflects the response of /incident updates call
type IncidentUpdatesService ¶
type IncidentUpdatesService struct {
// contains filtered or unexported fields
}
IncidentUpdatesService contains REST endpoints that belongs to cachet incidents.
func (*IncidentUpdatesService) Create ¶
func (s *IncidentUpdatesService) Create(incidentID int, i *IncidentUpdate) (*IncidentUpdate, *Response, error)
Create creates a new incident update.
Docs: https://docs.cachethq.io/reference#incidentsincidentupdates
func (*IncidentUpdatesService) Delete ¶
func (s *IncidentUpdatesService) Delete(incidentID int, updateID int) (*Response, error)
Delete deletes an incident update.
Docs: https://docs.cachethq.io/reference#incidentsincidentupdatesupdate
func (*IncidentUpdatesService) Get ¶
func (s *IncidentUpdatesService) Get(incidentID int, updateID int) (*IncidentUpdate, *Response, error)
Get returns a single incident update.
Docs: https://docs.cachethq.io/reference#incidentsidupdatesid
func (*IncidentUpdatesService) GetAll ¶
func (s *IncidentUpdatesService) GetAll(incidentID int) (*IncidentUpdateResponse, *Response, error)
GetAll return all updates by incident.
func (*IncidentUpdatesService) Update ¶
func (s *IncidentUpdatesService) Update(incidentID int, updateID int, i *IncidentUpdate) (*IncidentUpdate, *Response, error)
Update updates an incident update.
Docs: https://docs.cachethq.io/reference#incidentsincidentupdatesupdate-1
type IncidentsQueryParams ¶
type IncidentsQueryParams struct { ID int `url:"id,omitempty"` Name string `url:"name,omitempty"` Status int `url:"status,omitempty"` Visible int `url:"visible,omitempty"` ComponentID int `url:"component_id,omitempty"` Stickied bool `url:"stickied,omitempty"` QueryOptions }
IncidentsQueryParams contains fields to filter returned results
type IncidentsService ¶
type IncidentsService struct {
// contains filtered or unexported fields
}
IncidentsService contains REST endpoints that belongs to cachet incidents.
func (*IncidentsService) Create ¶
func (s *IncidentsService) Create(i *Incident) (*Incident, *Response, error)
Create a new incident.
func (*IncidentsService) Delete ¶
func (s *IncidentsService) Delete(id int) (*Response, error)
Delete delete an incident.
func (*IncidentsService) Get ¶
func (s *IncidentsService) Get(id int) (*Incident, *Response, error)
Get returns a single incident.
func (*IncidentsService) GetAll ¶
func (s *IncidentsService) GetAll(filter *IncidentsQueryParams) (*IncidentResponse, *Response, error)
GetAll return all incidents.
type Latest ¶
type Latest struct { TagName string `json:"tag_name"` Prelease bool `json:"prelease"` Draft bool `json:"draft"` }
Latest ...
type Meta ¶
type Meta struct {
Pagination Pagination `json:"pagination"`
}
Meta can contain extra information such as the current paging attributes or links to other pages. Some responses will contain a meta object.
type MetaVersion ¶
MetaVersion ...
type Metric ¶
type Metric struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Suffix string `json:"suffix,omitempty"` Description string `json:"description,omitempty"` DefaultValue int `json:"default_value"` CalcType int `json:"calc_type,omitempty"` DisplayChart bool `json:"display_chart,omitempty"` Places int `json:"places,omitempty"` DefaultView int `json:"default_view,omitempty"` Threshold int `json:"threshold,omitempty"` Order int `json:"order,omitempty"` Visible int `json:"visible,omitemtpy"` CreatedAt string `json:"created_at,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` DefaultViewName string `json:"default_view_name,omitempty"` }
Metric entity reflects one single metric
type MetricQueryParams ¶
type MetricQueryParams struct {
QueryOptions
}
MetricQueryParams contains fields to filter returned results
type MetricResponse ¶
type MetricResponse struct { Meta Meta `json:"meta,omitempty"` Metrics []Metric `json:"data,omitempty"` }
MetricResponse reflects the response of /metric call
type MetricsService ¶
type MetricsService struct {
// contains filtered or unexported fields
}
MetricsService contains REST endpoints that belongs to cachet metrics.
func (*MetricsService) Create ¶
func (s *MetricsService) Create(m *Metric) (*Metric, *Response, error)
Create a new metric.
func (*MetricsService) Delete ¶
func (s *MetricsService) Delete(id int) (*Response, error)
Delete a metric.
func (*MetricsService) DeletePoint ¶
func (s *MetricsService) DeletePoint(id, pointID int) (*Response, error)
DeletePoint deletes a metric point.
Docs: https://docs.cachethq.io/reference#delete-a-metric-point
func (*MetricsService) Get ¶
func (s *MetricsService) Get(id int) (*Metric, *Response, error)
Get returns a single metric, without points.
func (*MetricsService) GetAll ¶
func (s *MetricsService) GetAll(filter *MetricQueryParams) (*MetricResponse, *Response, error)
GetAll returns all metrics that have been setup.
type Pagination ¶
type Pagination struct { Total int `json:"total"` Count int `json:"count"` PerPage int `json:"per_page"` CurrentPage int `json:"current_page"` TotalPages int `json:"total_pages"` Links Links `json:"links"` }
Pagination will contain detail information about pages.
type PingResponse ¶
type PingResponse struct {
Data string `json:"data,omitempty"`
}
PingResponse entity contains the Response of a /ping call.
type Point ¶
type Point struct { ID int `json:"id,omitempty"` MetricID int `json:"metric_id,omitempty"` Value int `json:"value,omitempty"` CreatedAt string `json:"created_at,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` Counter int `json:"counter,omitempty"` CalculatedValue int `json:"calculated_value,omitempty"` }
Point is a single point in a Metric
type QueryOptions ¶
type QueryOptions struct { Page int `url:"page,omitempty"` PerPage int `url:"per_page,omitempty"` SortField string `url:"sort,omitempty"` OrderType string `url:"order,omitempty"` }
QueryOptions is a list of general params in each GET request.
type Response ¶
Response is a Cachet API response. This wraps the standard http.Response returned from Cachet.
type Schedule ¶
type Schedule struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Message string `json:"message,omitempty"` Status int `json:"status,omitempty"` ScheduledAt string `json:"scheduled_at,omitempty"` CompletedAt string `json:"completed_at,omitempty"` CreatedAt string `json:"created_at,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` Components []Component `json:"components,omitempty"` HumanStatus string `json:"human_status,omitempty"` }
Schedule entity reflects one single schedule
type ScheduleResponse ¶
type ScheduleResponse struct { Meta Meta `json:"meta,omitempty"` Schedules []Schedule `json:"data,omitempty"` }
ScheduleResponse reflects the response of schedules call
type SchedulesQueryParams ¶
type SchedulesQueryParams struct { ID int `url:"id,omitempty"` Name string `url:"name,omitempty"` Status int `url:"order,omitempty"` QueryOptions }
SchedulesQueryParams contains fields to filter returned results
type SchedulesService ¶
type SchedulesService struct {
// contains filtered or unexported fields
}
SchedulesService contains REST endpoints that belongs to cachet schedules.
func (*SchedulesService) Create ¶
func (s *SchedulesService) Create(i *Schedule) (*Schedule, *Response, error)
Create creates a new scheduled event.
Docs: https://docs.cachethq.io/reference#incidentsincidentupdates
func (*SchedulesService) Delete ¶
func (s *SchedulesService) Delete(id int) (*Response, error)
Delete deletes a scheduled event.
Docs: https://docs.cachethq.io/reference#incidentsincidentupdatesupdate
func (*SchedulesService) Get ¶
func (s *SchedulesService) Get(id int) (*Schedule, *Response, error)
Get returns a single scheduled event.
Docs: https://docs.cachethq.io/reference#incidentsidupdatesid
func (*SchedulesService) GetAll ¶
func (s *SchedulesService) GetAll(filter *SchedulesQueryParams) (*ScheduleResponse, *Response, error)
GetAll return all scheduled events.
func (*SchedulesService) Update ¶
Update updates a scheduled event.
Docs: https://docs.cachethq.io/reference#incidentsincidentupdatesupdate-1
type SortOrdering ¶
type SortOrdering struct { Sort string `json:"sort"` Order string `json:"order"` PerPage int `json:"per_page"` }
SortOrdering ...
type Status ¶
type Status struct { Status string `json:"status,omitempty"` Message string `json:"message,omitempty"` }
Status entity contains the contents of API Response of a /status call.
type StatusAPIResponse ¶
type StatusAPIResponse struct {
Data *Status `json:"data"`
}
StatusAPIResponse entity contains the Response of a /status call.
type Subscriber ¶
type Subscriber struct { ID int `json:"id,omitempty"` Email string `json:"email,omitempty"` VerifyCode string `json:"verify_code,omitempty"` VerifiedAt string `json:"verified_at,omitempty"` CreatedAt string `json:"created_at,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` }
Subscriber entity reflects one single subscriber
type SubscriberResponse ¶
type SubscriberResponse struct { Meta Meta `json:"meta,omitempty"` Subscribers []Subscriber `json:"data,omitempty"` }
SubscriberResponse reflects the response of /subscribers call
type SubscribersQueryParams ¶
type SubscribersQueryParams struct {
QueryOptions
}
SubscribersQueryParams contains fields to filter returned results
type SubscribersService ¶
type SubscribersService struct {
// contains filtered or unexported fields
}
SubscribersService contains REST endpoints that belongs to cachet subscribers.
func (*SubscribersService) Create ¶
func (s *SubscribersService) Create(email string, verify int) (*Subscriber, *Response, error)
Create a new subscriber.
func (*SubscribersService) Delete ¶
func (s *SubscribersService) Delete(id int) (*Response, error)
Delete a subscriber.
func (*SubscribersService) GetAll ¶
func (s *SubscribersService) GetAll(filter *SubscribersQueryParams) (*SubscriberResponse, *Response, error)
GetAll returns all subscribers.
type SubscriptionsService ¶
type SubscriptionsService struct {
// contains filtered or unexported fields
}
SubscriptionsService contains REST endpoints that belongs to cachet subscriptions.
func (*SubscriptionsService) Delete ¶
func (s *SubscriptionsService) Delete(id int) (*Response, error)
Delete deletes a subscription.
Docs: https://docs.cachethq.io/reference#incidentsincidentupdatesupdate
type Tags ¶
type Tags []string
func (*Tags) MarshalJSON ¶
For some bizarre reason, the Cachet API only accepts tags as a CSL.
func (*Tags) UnmarshalJSON ¶
But it returns tags as a map. Because? Who knows.
type VersionResponse ¶
type VersionResponse struct { Meta MetaVersion `json:"meta,omitempty"` Data string `json:"data,omitempty"` }
VersionResponse entity contains the Response of a /version call.