api

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAtlasBaseURL = "https://cloud.mongodb.com"

DefaultAtlasBaseURL is the default atlas prod base url

View Source
const DefaultBaseURL = "https://stitch.mongodb.com"

DefaultBaseURL is the default prod base url for Stitch apps

Variables

This section is empty.

Functions

func UnmarshalStitchError

func UnmarshalStitchError(res *http.Response) error

UnmarshalStitchError unmarshals an *http.Response into an ErrStitchResponse. If the Body does not contain content it uses the provided Status

Types

type AuthClient

type AuthClient struct {
	Client
	// contains filtered or unexported fields
}

AuthClient is a Client that is aware of a User's auth credentials

func NewAuthClient

func NewAuthClient(client Client, user *user.User) *AuthClient

NewAuthClient returns a new *AuthClient

func (*AuthClient) ExecuteRequest

func (ac *AuthClient) ExecuteRequest(method, path string, options RequestOptions) (*http.Response, error)

ExecuteRequest makes a call to the provided path, supplying the user's access token

func (*AuthClient) RefreshAuth

func (ac *AuthClient) RefreshAuth() (auth.Response, error)

RefreshAuth makes a call to the session endpoint using the user's refresh token in order to obtain a new access token

type Client

type Client interface {
	ExecuteRequest(method, path string, options RequestOptions) (*http.Response, error)
}

Client represents something that is capable of making HTTP requests

func NewClient

func NewClient(baseURL string) Client

NewClient returns a new Client

type ErrAppNotFound

type ErrAppNotFound struct {
	ClientAppID string
}

ErrAppNotFound is used when an app cannot be found by client app ID

func (ErrAppNotFound) Error

func (eanf ErrAppNotFound) Error() string

type ErrStitchResponse

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

ErrStitchResponse represents a response from a Stitch API call

func (ErrStitchResponse) Error

func (esr ErrStitchResponse) Error() string

Error returns a stringified error message

func (*ErrStitchResponse) UnmarshalJSON

func (esr *ErrStitchResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals JSON data into an ErrStitchResponse

type RequestOptions

type RequestOptions struct {
	Body   io.Reader
	Header http.Header
}

RequestOptions represents a simple set of options to use with HTTP requests

type StitchClient

type StitchClient interface {
	Authenticate(authProvider auth.AuthenticationProvider) (*auth.Response, error)
	Export(groupID, appID string, isTemplated bool) (string, io.ReadCloser, error)
	Import(groupID, appID string, appData []byte, strategy string) error
	Diff(groupID, appID string, appData []byte, strategy string) ([]string, error)
	FetchAppByClientAppID(clientAppID string) (*models.App, error)
	FetchAppsByGroupID(groupID string) ([]*models.App, error)
	CreateEmptyApp(groupID, appName string) (*models.App, error)
}

StitchClient represents a Client that can be used to call the Stitch Admin API

func NewStitchClient

func NewStitchClient(client Client) StitchClient

NewStitchClient returns a new StitchClient to be used for making calls to the Stitch Admin API

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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