common

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound     = NotFoundError{}
	ErrReqCreation  = RequestCreationError{}
	ErrReqExecution = RequestExecutionError{}
	ErrResDecoding  = ResponseDecodingError{}
)

Functions

func CloseBody

func CloseBody(res *http.Response) error

func CreateMeeting

func CreateMeeting(platformName string, client *http.Client, endpoint string, oauth domain.OAuthInfo, meeting interface{}, result interface{}, successCode int) error

CreateMeeting creates a meeting.

func CreateRequest

func CreateRequest(httpMethod string, url string, jsonBody interface{}, oauth domain.OAuthInfo) (*http.Request, error)

CreateRequest is a helper function that creates a request to be sent to a platform API. This function appends the provided OAuth token to the request in the Authorization header.

func DeleteMeeting

func DeleteMeeting(platformName string, client *http.Client, endpoint string, oauth domain.OAuthInfo, result interface{}, successCode int, meetingID string) error

DeleteMeeting deletes a meeting.

func GetMeeting

func GetMeeting(platformName string, client *http.Client, endpoint string, oauth domain.OAuthInfo, meetingID string, result interface{}, successCode int) error

GetMeeting gets a meeting.

func GetMeetings

func GetMeetings(platformName string, client *http.Client, endpoint string, oauth domain.OAuthInfo, paginationFunc AddPagination, result interface{}, successCode int) error

GetMeetings gets all meetings.

Types

type APIError

type APIError struct {
	Platform string
	Action   string
	Code     int
}

func NewAPIError

func NewAPIError(platform string, action string, code int) APIError

func (APIError) Error

func (z APIError) Error() string

func (APIError) Is

func (z APIError) Is(tgt error) bool

type AddPagination

type AddPagination func(url url.URL) url.URL

AddPagination is a function that takes a URL, adds information to it to get a specific page, and returns the URL

type NotFoundError

type NotFoundError struct {
	Resource    string
	ResourceID  string
	Requester   string
	RequesterID string
}

func NewNotFoundError

func NewNotFoundError(resource string, resourceID string, requester string, requesterID string) NotFoundError

func (NotFoundError) Error

func (n NotFoundError) Error() string

func (NotFoundError) Is

func (n NotFoundError) Is(tgt error) bool

type RequestCreationError

type RequestCreationError struct {
	Err error
	URL string
}

func NewRequestCreationError

func NewRequestCreationError(url string, err error) RequestCreationError

func (RequestCreationError) Error

func (r RequestCreationError) Error() string

func (RequestCreationError) Is

func (r RequestCreationError) Is(tgt error) bool

type RequestExecutionError

type RequestExecutionError struct {
	Err error
	URL string
}

func NewRequestExecutionError

func NewRequestExecutionError(url string, err error) RequestExecutionError

func (RequestExecutionError) Error

func (r RequestExecutionError) Error() string

func (RequestExecutionError) Is

func (r RequestExecutionError) Is(tgt error) bool

type ResponseDecodingError

type ResponseDecodingError struct {
	Err error
	URL string
}

func NewResponseDecodingError

func NewResponseDecodingError(url string, err error) ResponseDecodingError

func (ResponseDecodingError) Error

func (r ResponseDecodingError) Error() string

func (ResponseDecodingError) Is

func (r ResponseDecodingError) Is(tgt error) bool

Jump to

Keyboard shortcuts

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