Documentation
¶
Index ¶
Constants ¶
This section is empty.
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. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
Types ¶
type AuthResponse ¶
type AuthResponse struct {
ClientID *string `json:"clientId"`
ClientName *string `json:"clientName"`
PhoneNumber *string `json:"phoneNumber"`
}
AuthResponse the reponse back from /auth/login
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
AuthService handles calls to /groups
func (*AuthService) Login ¶
func (s *AuthService) Login(phoneNumber, clientName string) (*AuthResponse, *Response, error)
Login to a users account
func (*AuthService) Verify ¶
func (s *AuthService) Verify(verificationCode string, auth *AuthResponse) (*Credentials, *Response, error)
Verify to a users account
type Client ¶
type Client struct {
// Base URL for API requests. Defaults to the public GitHub API, but can be
// set to a domain endpoint to use with GitHub Enterprise. BaseURL should
// always be specified with a trailing slash.
BaseURL *url.URL
// User agent used when communicating with the GitHub API.
UserAgent string
Credentials *Credentials
Groups *GroupsService
Auth *AuthService
Stats *StatsService
// contains filtered or unexported fields
}
A Client manages communication with the GitHub API.
func NewAuthenticatedClient ¶
NewAuthenticatedClient returns a new Authenticted Statx API client
func NewClient ¶
NewClient returns a new Statx API client. If a nil httpClient is provided, http.DefaultClient will be used.
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 Credentials ¶
Credentials is the response from /auth/verifyCode
type Group ¶
type Group struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
}
Group holds the group info
type GroupList ¶
type GroupList struct {
Data []Group `json:"data"`
}
GroupList holds the list of groups from GET /groups
type GroupsService ¶
type GroupsService struct {
// contains filtered or unexported fields
}
GroupsService handles calls to /groups
type Response ¶
Response is a GitHub API response. This wraps the standard http.Response returned from GitHub and provides convenient access to things like pagination links.
type Stat ¶
type Stat struct {
ID string `json:"id,omitempty"`
Title string `json:"title,omitempty"`
VisualType string `json:"visualType,omitempty"`
Notes string `json:"notes,omitempty"`
Value string `json:"value,omitempty"`
DueDateTime *time.Time `json:"dueDateTime,omitempty"`
LastUpdatedDateTime *time.Time `json:"lastUpdatedDateTime,omitempty"`
NotesLastUpdatedDateTime *time.Time `json:"notesLastUpdatedDateTime,omitempty"`
}
Stat holds generic stat data
func (*Stat) UpdateTimestamps ¶
func (stat *Stat) UpdateTimestamps()
UpdateTimestamps - Populate the timestamps for a stat before saving
type StatsService ¶
type StatsService struct {
// contains filtered or unexported fields
}
StatsService handles calls to /stats
func (*StatsService) Get ¶
func (s *StatsService) Get(groupID, statID string) (*Stat, *Response, error)
Get - gets information about a single group