api

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2019 License: Apache-2.0 Imports: 13 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)
	FetchAppByGroupIDAndClientAppID(groupID, clientAppID string) (*models.App, error)
	FetchAppByClientAppID(clientAppID string) (*models.App, error)
	FetchAppsByGroupID(groupID string) ([]*models.App, error)
	CreateEmptyApp(groupID, appName, location, deploymentModel string) (*models.App, error)
	UploadAsset(groupID, appID, path, hash string, size int64, body io.Reader, attributes ...hosting.AssetAttribute) error
	CopyAsset(groupID, appID, fromPath, toPath string) error
	MoveAsset(groupID, appID, fromPath, toPath string) error
	DeleteAsset(groupID, appID, path string) error
	SetAssetAttributes(groupID, appID, path string, attributes ...hosting.AssetAttribute) error
	ListAssetsForAppID(groupID, appID string) ([]hosting.AssetMetadata, error)
	InvalidateCache(groupID, appID, path string) 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