Documentation ¶
Index ¶
- Constants
- type Akerun
- type AkerunList
- type AkerunListParameter
- type Client
- func (c *Client) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
- func (c *Client) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)
- func (c *Client) GetAkeruns(ctx context.Context, oauth2Token *oauth2.Token, organizationId string, ...) (*AkerunList, error)
- func (c *Client) GetOrganization(ctx context.Context, oauth2Token *oauth2.Token, id string) (*Organization, error)
- func (c *Client) GetOrganizations(ctx context.Context, oauth2Token *oauth2.Token, params OrganizationsParameter) (*OrganizationList, error)
- func (c *Client) GetTokenInfo(ctx context.Context, token *oauth2.Token) (*TokenInfo, error)
- func (c *Client) RefreshToken(ctx context.Context, token *oauth2.Token) (*oauth2.Token, error)
- func (c *Client) Revoke(ctx context.Context, token *oauth2.Token) error
- type Config
- type Error
- type Organization
- type OrganizationList
- type OrganizationsParameter
- type TokenInfo
Constants ¶
const ( APIUrl = "https://api.akerun.com" APIVerison = "/v3" Oauth2AuthURL = "https://api.akerun.com/oauth/authorize" Oauth2TokenURL = "https://api.akerun.com/oauth/token" )
Akerun API URLs
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Akerun ¶ added in v0.0.5
type Akerun struct { ID string `json:"id"` Name string `json:"name"` ImageURL string `json:"image_url"` OpenDoorAlert bool `json:"open_door_alert"` OpenDoorAlertSecond int `json:"open_door_alert_second"` PushButton bool `json:"push_button"` NormalSoundVolume int `json:"normal_sound_volume"` AlertSoundVolume int `json:"alert_sound_volume"` BatteryPercentage int `json:"battery_percentage"` Autolock bool `json:"autolock"` AutolockOffSchedule struct { StartTime string `json:"start_time"` EndTime string `json:"end_time"` DaysOfWeek []int `json:"days_of_week"` } `json:"autolock_off_schedule"` AkerunRemote struct { ID string `json:"id"` } `json:"akerun_remote"` NFCReaderInside struct { ID string `json:"id"` BatteryPercentage int `json:"battery_percentage"` } `json:"nfc_reader_inside"` NFCReaderOutside struct { ID string `json:"id"` BatteryPercentage int `json:"battery_percentage"` } `json:"nfc_reader_outside"` DoorSensor struct { ID string `json:"id"` BatteryPercentage int `json:"battery_percentage"` } `json:"door_sensor"` }
type AkerunList ¶ added in v0.0.5
type AkerunList struct {
Akeruns []Akerun `json:"akeruns"`
}
type AkerunListParameter ¶ added in v0.0.5
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the Akerun client.
func (*Client) AuthCodeURL ¶
func (c *Client) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
AuthCodeURL returns a URL to OAuth 2.0 provider's consent page that asks for permissions for the required scopes explicitly.
func (*Client) Exchange ¶
func (c *Client) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)
Exchange converts an authorization code into a token.
func (*Client) GetAkeruns ¶ added in v0.0.5
func (c *Client) GetAkeruns(ctx context.Context, oauth2Token *oauth2.Token, organizationId string, params AkerunListParameter) (*AkerunList, error)
func (*Client) GetOrganization ¶
func (c *Client) GetOrganization(ctx context.Context, oauth2Token *oauth2.Token, id string) (*Organization, error)
GetOrganization retrieves the details of an organization with the specified ID.
func (*Client) GetOrganizations ¶
func (c *Client) GetOrganizations( ctx context.Context, oauth2Token *oauth2.Token, params OrganizationsParameter) (*OrganizationList, error)
GetOrganizations returns a list of organizations.
func (*Client) GetTokenInfo ¶
GetTokenInfo retrieves the token information for the given OAuth2 token.
func (*Client) RefreshToken ¶
RefreshToken returns a new token that carries the same authorization as token, but with a renewed access token.
type Organization ¶
Organization represents the detailed information of an organization.
type OrganizationList ¶ added in v0.0.5
type OrganizationList struct {
Organizations []id `json:"organizations"`
}
OrganizationList represents a list of organizations in Akerun API.
type OrganizationsParameter ¶ added in v0.0.5
type OrganizationsParameter struct { Limit uint32 `url:"limit,omitempty"` IdAfter string `url:"id_after,omitempty"` IdBefore string `url:"id_before,omitempty"` }
OrganizationsParameter represents the parameters for GetOrganizations method.
type TokenInfo ¶
type TokenInfo struct { ApplicationName string `json:"application_name"` AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` CreatedAt string `json:"created_at"` ExpiresAt string `json:"expires_at"` }
TokenInfo represents the structure of the token information.