gql

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActiveClient

func ActiveClient(room string) (*graphql.Client, string, string, string)

ActiveClient constructs the gql client for the currently active profile. Return the gql client, endpint, key and token.

func ActiveSystemMode

func ActiveSystemMode() string

ActiveSystemMode checks the system mode of currently active profile.

func AllErrorCodes

func AllErrorCodes() ([]string, error)

AllErrorCodes returns all the available error codes.

func AllProjectImages

func AllProjectImages(pid string, first, last int, before, after string) ([]types.ProjectImage, *types.PageInfo, int, error)

AllProjectImages queries all of the project images by cursor.

func Arbitrary

func Arbitrary(query string, vars map[string]interface{}) (string, error)

Arbitrary makes arbitrary query or mutation.

func BucketList

func BucketList(kind, cloud string) ([]string, error)

BucketList returns a list of available buckets supported by the api server. kind is "image", "model" or "meta". cloud is "s3", "oss" or "minio".

func CheckDirectNetwork

func CheckDirectNetwork(url string) bool

CheckDirectNetwork tests if the api server could reach this client.

func CheckSystemMode

func CheckSystemMode(endpoint, key string) string

CheckSystemMode checks if the api server is in Normal, ReadOnly or Offline mode.

func CheckSystemModeWithTimeout

func CheckSystemModeWithTimeout(endpoint, key string, timeout time.Duration) string

CheckSystemModeWithTimeout checks the api server with network timeout.

func CoinsToMoney

func CoinsToMoney(coins float64, currency string) (float64, error)

CoinsToMoney converts coins into real currency.

func CreateProject

func CreateProject(name, projType, modelType, visibility string) (string, error)

CreateProject creates a new empty project and returns the pid of the newly created project.

func CurrencyList

func CurrencyList() ([]string, error)

CurrencyList returns a list of available currency supported by the api server.

func DoneImageUpload

func DoneImageUpload(iid string) (string, error)

DoneImageUpload signals the end of image uploading. Return the new image state with error.

func DoneModelUpload

func DoneModelUpload(pid string, merge bool) (string, error)

DoneModelUpload signals the completion of (multipart) model upload. Args merge tell if to merge the multiparts first. Return the state of the project.

func Endpoints

func Endpoints(endpoint, key string) (*types.Endpoints, error)

Endpoints gets the endpoints of altizure servers.

func EnumValues

func EnumValues(typeName string) ([]string, error)

EnumValues gets the list of enum values by type name.

func GetSTS

func GetSTS(pid, bucket string) (*types.STS, error)

GetSTS obtains the STS creds for this project.

func GetUserTokenByCode

func GetUserTokenByCode(endpoint, appKey, phone, code string) (string, error)

GetUserTokenByCode gets the self-issued by phone and one-time login code.

func GetUserTokenByEmail

func GetUserTokenByEmail(endpoint, appKey, email, password string, fresh bool) (string, error)

GetUserTokenByEmail gets the self-issued user token.

func HasImage

func HasImage(pid, checksum string) (bool, error)

HasImage asks if the project has the given image by hash.

func HasMetaFile

func HasMetaFile(pid, checksum string) (bool, error)

HasMetaFile asks if the project has the given meta file by hash.

func IsSales

func IsSales(endpoint, key, token string) bool

IsSales checks if the provided creds is a sales.

func IsSuper

func IsSuper(endpoint, key, token string) bool

IsSuper checks if the provided creds is a superuser.

func MoneyToCoins

func MoneyToCoins(money float64, currency string) (float64, error)

MoneyToCoins converts money into coins.

func MyProjects

func MyProjects(first, last int, before, after, search string) ([]types.Project, *types.PageInfo, int, error)

MyProjects queries simple info of my first 50 projects.

func MySelf

func MySelf() (string, *types.User, error)

MySelf queries simple info of current user.

func MySelfByKeyToken added in v1.1.0

func MySelfByKeyToken(endpoint, key, token string) (string, *types.User, error)

MySelfByKeyToken queries simple info of a specific user.

func PrettyPrint

func PrettyPrint(data []byte) (string, error)

PrettyPrint prints a raw json string into an indented colored string.

func Project

func Project(id string) (*types.Project, error)

Project return the project by the given id.

func ProjectImage

func ProjectImage(pid, iid string) (*types.Image, error)

ProjectImage return the info of a project image.

func ProjectMetaFile

func ProjectMetaFile(pid, mid string) (*types.MetaFile, error)

ProjectMetaFile return the info of a project meta file.

func QueryBucket

func QueryBucket(kind, cloud, bucket string) (string, []string, error)

QueryBucket infers the exact bucket name from query string bucket. kind is "image", "model" or "meta". cloud is "s3", "oss" or "minio".

func QueryCurrency

func QueryCurrency(currency string) (string, []string, error)

QueryCurrency infers the exact currency name from query string currency.

func QueryTaskType

func QueryTaskType(taskType string) (string, []string, error)

QueryTaskType infers the exact task type name from query string taskType.

func RefreshSTS

func RefreshSTS(pid, bucket string) func() (*types.STS, error)

RefreshSTS is a HOF of GetSTS for refreshing the STS.

func RegisterImageMinio

func RegisterImageMinio(pid, bucket, filename, imageType, checksum string) (*types.Image, string, error)

RegisterImageMinio registers a minio image. And get back the registered image and the signed url to minio.

func RegisterImageOSS

func RegisterImageOSS(pid, bucket, filename, imageType, checksum string) (*types.Image, error)

RegisterImageOSS registers an OSS image, without getting the STS creds. Return the registered image.

func RegisterImageS3

func RegisterImageS3(pid, bucket, filename, imageType, checksum string) (*types.Image, string, error)

RegisterImageS3 registers a S3 image. And get back the registered image and the signed url to S3.

func RegisterImageURL

func RegisterImageURL(pid, url, filename, checksum string) (*types.Image, error)

RegisterImageURL registers an to be uploaded image by url.

func RegisterMetaFileMinio

func RegisterMetaFileMinio(pid, bucket, filename string) (*types.MetaFile, string, error)

RegisterMetaFileMinio registers a Minio meta file. And get back the registered meta file and the signed url to Minio.

func RegisterMetaFileS3

func RegisterMetaFileS3(pid, bucket, filename string) (*types.MetaFile, string, error)

RegisterMetaFileS3 registers a S3 meta file. And get back the registered meta file and the signed url to S3.

func RegisterMetaURL

func RegisterMetaURL(pid, url, filename, checksum string) (*types.MetaFile, error)

RegisterMetaURL registers a to be uploaded meta file by url.

func RegisterModelMinio

func RegisterModelMinio(pid, bucket, filename string) (*types.Model, string, error)

RegisterModelMinio registers a Minio model. And get back the registered model and the signed url to Minio.

func RegisterModelS3

func RegisterModelS3(pid, bucket, filename string) (*types.Model, string, error)

RegisterModelS3 registers a S3 model. And get back the registered model and the signed url to S3.

func RegisterModelURL

func RegisterModelURL(pid, url, filename, checksum string) (*types.ImportedModel, error)

RegisterModelURL registers a to be uploaded model by url.

func RemoveProject

func RemoveProject(pid string) (*types.Project, error)

RemoveProject removes a project by the given pid.

func ReportProject

func ReportProject(pid, desc string) error

ReportProject reports a project with error description.

func RequestLoginCode

func RequestLoginCode(endpoint, appKey, phone string) error

RequestLoginCode requests an one-time login code via sms.

func SearchProjectID

func SearchProjectID(id string, myProj bool) (*types.Project, error)

SearchProjectID returns the latest project id by the given partial id.

func SetProfileFace added in v1.1.1

func SetProfileFace(imgStr string) (string, error)

SetProfileFace set the profile image with the given image string. Return the result of operation.

func StartImageUpload

func StartImageUpload(iid string) (string, error)

StartImageUpload signals the start of image uploading. Return the new image state with error.

func StartReconstruction

func StartReconstruction(pid, taskType string) (*types.Task, error)

StartReconstruction starts a reconstruction by project id.

func StopReconstruction

func StopReconstruction(pid string) (*types.Task, error)

StopReconstruction starts a reconstruction by project id.

func SuggestedBucket

func SuggestedBucket(kind, cloud string) (string, error)

SuggestedBucket returns the nearest bucket from api server. kind is "image", "model" or "meta". cloud is "s3", "oss" or "minio".

func SupportedCloud

func SupportedCloud(endpoint, key, kind string) []string

SupportedCloud queries for the supported cloud of the given endpoint. kind is "image" or "model" or "meta".

func TransferCoins

func TransferCoins(coins float64, email, message string) (string, error)

TransferCoins transfers coins from my account to other user, with a custom message.

func TransferProject

func TransferProject(pid, email, message string) (string, error)

TransferProject transfers project from my account to other user, with a custom message.

func Version

func Version(endpoint, key string) (string, time.Duration)

Version gets the current version of api server.

func WebEndpoint

func WebEndpoint() string

WebEndpoint returns the current active web domain.

Types

type AccountInfo

type AccountInfo struct {
	Super        bool
	Sales        bool
	ImageCloud   []string
	ModelCloud   []string
	MetaCloud    []string
	Version      string
	ResponseTime time.Duration
}

AccountInfo represents the account info.

func GetAccountInfo

func GetAccountInfo(endpoint, key, token string) AccountInfo

GetAccountInfo gets the account info.

func GetAccountInfoTimeout

func GetAccountInfoTimeout(endpoint, key, token string, timeout time.Duration) (AccountInfo, error)

GetAccountInfoTimeout gets the account info with timeout.

type ErrorCodeInfo

type ErrorCodeInfo struct {
	Code        string
	Description string
	Solution    string
}

ErrorCodeInfo represents the error code and its description and solution.

func GetErrorCodeInfo

func GetErrorCodeInfo(code, lang string) (*ErrorCodeInfo, error)

GetErrorCodeInfo gets the description and solution of an error code.

Jump to

Keyboard shortcuts

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