apiclient

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	SubDomain   string
	AccessToken string
	BaseURL     string
	HTTPClient  *http.Client
}

Client - Api client struct

func MakeClient

func MakeClient(subDomain string, accessToken string, httpClient *http.Client) Client

MakeClient - Generates an api client. Pass in httpClient to override defaults

func (Client) Event

func (c Client) Event(id int) (*data.Event, error)

Event - Retrieves an individual event

func (Client) Events

func (c Client) Events(rq *RequestQuery, es *[]data.Event) (*ClientResponse, error)

Events - Get events from the api client

func (Client) RequestEvents added in v0.3.0

func (c Client) RequestEvents(rq *RequestQuery) (*EventsResponse, error)

RequestEvents - Requests events from the client

func (Client) RequestUsers added in v0.3.0

func (c Client) RequestUsers(rq *RequestQuery) (*UsersResponse, error)

RequestUsers - Requests users from the client

func (Client) User

func (c Client) User(id int) (*data.User, error)

User - Retrieves an individual user based on ID

func (Client) Users

func (c Client) Users(rq *RequestQuery, us *[]data.User) (*ClientResponse, error)

Users - Get users from the api client

type ClientResponse added in v0.3.0

type ClientResponse struct {
	Data       interface{}
	Pagination ResponsePagination
}

ClientResponse - Response structure from any of the multiple requests

type EventsResponse

type EventsResponse struct {
	Events     []data.Event
	Pagination ResponsePagination
}

EventsResponse - Response back from the client on requesting events

type RequestQuery

type RequestQuery struct {
	View         string `url:"view"`
	Sort         string `url:"sort"`
	Filter       string `url:"filter"`
	SelectedPage int    `url:"selectedPage"`
	PageSize     int    `url:"pageSize"`
}

RequestQuery - Query used to request different variables

func (*RequestQuery) NextPage added in v0.3.0

func (rq *RequestQuery) NextPage(rp ResponsePagination) error

NextPage - Update the request query to get the next page. Throws an error if there is not another page

type ResponsePagination

type ResponsePagination struct {
	ItemCount    int
	PageCount    int
	PageSize     int
	SelectedPage int
}

ResponsePagination - Struct detailing what data has been returned and is available

type UsersResponse

type UsersResponse struct {
	Users      []data.User
	Pagination ResponsePagination
}

UsersResponse - Response back from the client on requesting users

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL