client

package
v0.0.0-...-835c9c4 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2021 License: MIT Imports: 21 Imported by: 0

README

This folder is generated

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes a 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

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	AdminApi *AdminApiService

	AuthApi *AuthApiService

	UserApi *UserApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the API v 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

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

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 swagger 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 AdminApiGroupsOpts

type AdminApiGroupsOpts struct {
	Limit  optional.Int64
	Cursor optional.Int64
	Filter optional.String
}

type AdminApiService

type AdminApiService service

func (*AdminApiService) CurrentSettings

func (a *AdminApiService) CurrentSettings(ctx context.Context) (Setting, *http.Response, error)

AdminApiService Returns the current application settings.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return Setting

func (*AdminApiService) Group

AdminApiService Returns a group and its users.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param id

@return GroupResponsePayload

func (*AdminApiService) Groups

func (*AdminApiService) Impersonate

func (a *AdminApiService) Impersonate(ctx context.Context, id int64) (TokenPayload, *http.Response, error)

AdminApiService Gets an authentication token for an admin that allows scoping as a user

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param id

@return TokenPayload

func (*AdminApiService) InitializeSync

AdminApiService Returns a google sheet reference.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return SheetResponsePayload

func (*AdminApiService) RunSync

AdminApiService Returns a google sheet reference.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return SheetResponsePayload

func (*AdminApiService) RunSyncOnce

func (a *AdminApiService) RunSyncOnce(ctx context.Context, id int64) (*http.Response, error)

AdminApiService Returns a google sheet reference.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param id

func (*AdminApiService) User

AdminApiService Returns a user and its group.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param id

@return UserResponsePayload

func (*AdminApiService) Users

type AdminApiUsersOpts

type AdminApiUsersOpts struct {
	Limit  optional.Int64
	Cursor optional.Int64
	Filter optional.String
}

type AuthApiService

type AuthApiService service

func (*AuthApiService) ExchangeAdmin

func (a *AuthApiService) ExchangeAdmin(ctx context.Context, body TokenPayload) (TokenPayload, *http.Response, error)

AuthApiService Exchanges a google authentication token with an admin api token.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body

@return TokenPayload

func (*AuthApiService) ExchangeFacebook

func (a *AuthApiService) ExchangeFacebook(ctx context.Context, body TokenPayload) (TokenPayload, *http.Response, error)

AuthApiService Exchanges a facebook authentication token with an api token.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body

@return TokenPayload

func (*AuthApiService) ExchangeGoogle

func (a *AuthApiService) ExchangeGoogle(ctx context.Context, body TokenPayload) (TokenPayload, *http.Response, error)

AuthApiService Exchanges a google authentication token with an api token.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body

@return TokenPayload

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 ErrorPayload

type ErrorPayload struct {
	Error_ string `json:"error,omitempty"`
}

ErrorPayload wraps errors in a well-defined api payload

type GenericSwaggerError

type GenericSwaggerError struct {
	// contains filtered or unexported fields
}

GenericSwaggerError Provides access to the body, error and model on returned errors.

func (GenericSwaggerError) Body

func (e GenericSwaggerError) Body() []byte

Body returns the raw bytes of the response

func (GenericSwaggerError) Error

func (e GenericSwaggerError) Error() string

Error returns non-empty string if there was an error.

func (GenericSwaggerError) Model

func (e GenericSwaggerError) Model() interface{}

Model returns the unpacked model of the error

type Group

type Group struct {
	Archived  bool      `json:"archived,omitempty"`
	CreatedAt time.Time `json:"createdAt,omitempty"`
	Id        int64     `json:"id,omitempty"`
	Name      string    `json:"name,omitempty"`
	Published bool      `json:"published,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
	ZoomLink  string    `json:"zoomLink,omitempty"`
}

type GroupResponsePayload

type GroupResponsePayload struct {
	Group *Group `json:"group,omitempty"`
	Users []User `json:"users,omitempty"`
}

GroupResponsePayload contains the queried group and its users

type GroupsResponsePayload

type GroupsResponsePayload struct {
	Groups     []Group     `json:"groups,omitempty"`
	Pagination *Pagination `json:"pagination,omitempty"`
}

GroupsResponsePayload contains paginated groups

type Pagination

type Pagination struct {
	Cursor int64  `json:"cursor,omitempty"`
	Filter string `json:"filter,omitempty"`
	Limit  int64  `json:"limit,omitempty"`
}

Pagination holds query data for pagination

type ProfileResponsePayload

type ProfileResponsePayload struct {
	User *UserWithGroup `json:"user,omitempty"`
}

ProfileResponsePayload contains user profile information

type Setting

type Setting struct {
	Id        int64     `json:"id,omitempty"`
	Script    string    `json:"script,omitempty"`
	Sheet     string    `json:"sheet,omitempty"`
	SyncOnce  string    `json:"syncOnce,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

type SheetResponsePayload

type SheetResponsePayload struct {
	Sheet string `json:"sheet,omitempty"`
}

SheetResponsePayload contains the synchronized Google sheet

type TokenPayload

type TokenPayload struct {
	Token string `json:"token,omitempty"`
}

TokenPayload contain the body parameters for a token exchange

type User

type User struct {
	Blocked   bool      `json:"blocked,omitempty"`
	CreatedAt time.Time `json:"createdAt,omitempty"`
	Email     string    `json:"email,omitempty"`
	Id        int64     `json:"id,omitempty"`
	Name      string    `json:"name,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

type UserApiService

type UserApiService service

func (*UserApiService) Logout

UserApiService Log out of the user account.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return TokenPayload

func (*UserApiService) Profile

UserApiService Returns the users profile.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return ProfileResponsePayload

type UserResponsePayload

type UserResponsePayload struct {
	User *UserWithGroup `json:"user,omitempty"`
}

UserResponsePayload contains the queried user

type UserWithGroup

type UserWithGroup struct {
	Blocked   bool      `json:"blocked,omitempty"`
	CreatedAt time.Time `json:"createdAt,omitempty"`
	Email     string    `json:"email,omitempty"`
	Group     *Group    `json:"group,omitempty"`
	Id        int64     `json:"id,omitempty"`
	Name      string    `json:"name,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

UserWithGroup is a User model with eagerly loaded group data

type UsersResponsePayload

type UsersResponsePayload struct {
	Pagination *Pagination     `json:"pagination,omitempty"`
	Users      []UserWithGroup `json:"users,omitempty"`
}

UsersResponsePayload contains the paginated users

Jump to

Keyboard shortcuts

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