client

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseAuthorizationURL = "https://login.afosto.io/authorize"
	BaseApiUrl           = "https://api.afosto.io"
	OauthClientID        = "51403354ded11942d7195c66b9e81f71b74f56cd8adc539277823e179da8"
	RedirectURL          = "http://localhost:8888/return"
)
View Source
const (
	FileServiceUrl = "https://api.afosto.io/cnt"
)

Variables

View Source
var (
	Jwt = ctxKey{Name: "jwt"}
)

Functions

func GetAuthorizationURL

func GetAuthorizationURL(scopes []string) string

Types

type AfostoClient

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

func GetClient

func GetClient(tenantID string, accessToken string) *AfostoClient

func (*AfostoClient) GetTenant

func (ac *AfostoClient) GetTenant() (*data.Tenant, error)

func (*AfostoClient) Query

func (ac *AfostoClient) Query(query string, parameters interface{}) (*QueryResult, error)

type File added in v0.0.15

type File struct {
	ID        string            `json:"id"`
	Filename  string            `json:"filename"`
	Label     string            `json:"label"`
	Dir       string            `json:"dir"`
	Type      string            `json:"type"`
	Mime      string            `json:"mime"`
	Url       string            `json:"url"`
	IsPublic  bool              `json:"is_public"`
	IsListed  bool              `json:"is_listed"`
	Metadata  map[string]string `json:"metadata"`
	CreatedAt time.Time         `json:"created_at"`
	UpdatedAt time.Time         `json:"updated_at"`
}

type FileClient added in v0.0.15

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

func NewFileClient added in v0.0.15

func NewFileClient() *FileClient

func (*FileClient) GetPublicSignature added in v0.0.15

func (c *FileClient) GetPublicSignature(ctx context.Context, dir string, method string) (string, error)

func (*FileClient) GetSignature added in v0.0.15

func (c *FileClient) GetSignature(ctx context.Context, dir string, method string) (string, error)

func (*FileClient) GetSignedURL added in v0.0.15

func (c *FileClient) GetSignedURL(ctx context.Context, fileID string) (string, error)

func (*FileClient) Upload added in v0.0.15

func (c *FileClient) Upload(ctx context.Context, source io.ReadCloser, labelFilename string, signature string) (*File, error)

type Query

type Query struct {
	OperationName *string     `json:"operationName"`
	Query         string      `json:"query"`
	Variables     interface{} `json:"variables"`
}

type QueryError

type QueryError struct {
	Message string   `json:"message"`
	Path    []string `json:"path"`
}

type QueryResult

type QueryResult struct {
	Data   map[string]interface{} `json:"data"`
	Errors []QueryError           `json:"errors"`
}

type Signature added in v0.0.15

type Signature struct {
	ExpiresAt time.Time `json:"expires_at"`
	Signature string    `json:"signature"`
}

Jump to

Keyboard shortcuts

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