api

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotLogined means user was not logined
	ErrNotLogined = errors.New("not logined")
)

Functions

func DeleteFile

func DeleteFile(appID string, objectID string) error

DeleteFile will delete the specific file

func DeployAppFromFile

func DeployAppFromFile(appID string, projectPath string, groupName string, fileURL string) (string, error)

DeployAppFromFile will deploy applications with specific file returns the event token for polling deploy log

func DeployAppFromGit

func DeployAppFromGit(appID string, projectPath string, groupName string) (string, error)

DeployAppFromGit will deploy applications with user's git repo returns the event token for polling deploy log

func DeployImage

func DeployImage(appID string, groupName string, imageTag string) (string, error)

DeployImage will deploy the engine group with specify image tag

func GetAppRegion

func GetAppRegion(appID string) (regions.Region, error)

GetAppRegion will query the app router, and return the app's region. The result is cached in process memory.

func LoginUSRegion

func LoginUSRegion() error

LoginUSRegion will use OAuth2 to login US Region

func NewErrorFromBody

func NewErrorFromBody(body string) error

NewErrorFromBody format LeanCloud Server

func PollEvents

func PollEvents(appID string, tok string, writer io.Writer) (bool, error)

PollEvents will poll the server's event logs and print the result to the given io.Writer

Types

type Client

type Client struct {
	CookieJar *cookiejar.Jar
	Region    regions.Region
}

Client info

func NewClient

func NewClient(region regions.Region) *Client

NewClient initilized a new Client

type Error

type Error struct {
	Code         int    `json:"code"`
	Content      string `json:"error"`
	ErrorEventID string `json:"errorEventID"`
}

Error is the LeanCloud API Server API common error format

func (Error) Error

func (err Error) Error() string

type GetAppInfoResult

type GetAppInfoResult struct {
	AppID          string `json:"app_id"`
	AppKey         string `json:"app_key"`
	AppName        string `json:"app_name"`
	MasterKey      string `json:"master_key"`
	AppDomain      string `json:"app_domain"`
	LeanEngineMode string `json:"leanengine_mode"`
}

GetAppInfoResult is GetAppInfo function's result type

func GetAppInfo

func GetAppInfo(appID string) (*GetAppInfoResult, error)

GetAppInfo returns the application's detail info

type GetAppListResult

type GetAppListResult struct {
	AppID     string `json:"app_id"`
	AppKey    string `json:"app_key"`
	AppName   string `json:"app_name"`
	MasterKey string `json:"master_key"`
	AppDomain string `json:"app_domain"`
}

GetAppListResult is GetAppList function's result type

func GetAppList

func GetAppList(region regions.Region) ([]*GetAppListResult, error)

GetAppList returns the current user's all LeanCloud application

type GetGroupsResult

type GetGroupsResult struct {
	GroupName string `json:"groupName"`
	Prod      int    `json:"prod"`
	Instances []struct {
		Name  string `json:"name"`
		Quota int    `json:"quota"`
	} `json:"instances"`
	CurrentImage struct {
		Runtime  string `json:"runtime"`
		ImageTag string `json:"imageTag"`
	} `json:"currentImage"`
}

GetGroupsResult is GetGroups's result struct

func GetGroups

func GetGroups(appID string) ([]*GetGroupsResult, error)

GetGroups returns the application's engine groups

type GetUserInfoResult

type GetUserInfoResult struct {
	Email    string `json:"email"`
	UserName string `json:"username"`
}

GetUserInfoResult is the return type of GetUserInfo

func GetUserInfo

func GetUserInfo() (*GetUserInfoResult, error)

GetUserInfo returns the current logined user info

func Login

func Login(email string, password string) (*GetUserInfoResult, error)

Login LeanCloud account

type UploadFileResult

type UploadFileResult struct {
	ObjectID string `json:"objectID"`
	URL      string `json:"url"`
}

UploadFileResult is the UploadFile's return type

func UploadFile

func UploadFile(appID string, filePath string) (*UploadFileResult, error)

UploadFile upload specific file to LeanCloud

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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