client

package
v0.0.0-...-1d7c9fa Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRequestFormat    = errors.New("failed to generate the request")
	ErrRequestSend      = errors.New("request failed")
	ErrReadBody         = errors.New("failed to read the response body")
	ErrUnexpectedStatus = errors.New("unexpected response status")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	ClientID          string   `json:"client_id"`
	ClientSecret      string   `json:"client_secret"`
	ClientName        string   `json:"client_name"`
	ClientKind        string   `json:"client_kind,omitempty"`
	ClientURI         string   `json:"client_uri,omitempty"`
	LogoURI           string   `json:"logo_uri,omitempty"`
	PolicyURI         string   `json:"policy_uri,omitempty"`
	RedirectURIs      []string `json:"redirect_uris"`
	RegistrationToken string   `json:"registration_access_token,omitempty"`
	SecretExpiresAt   int      `json:"client_secret_expires_at"`
	SoftwareID        string   `json:"software_id"`
	SoftwareVersion   string   `json:"software_version,omitempty"`
}

type DeleteCmd

type DeleteCmd struct {
	ClientName      string
	RegistrationCmd string
}

type HTTPClient

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

HTTPClient is the main interface used to interact with an the Client resource.

func NewHTTPClient

func NewHTTPClient(inst *instance.Instance) *HTTPClient

NewHTTPClient instantiate a new [Service] for the given domain.

The domain is an base url to your instance. For example it would be "https://foobar.mycozy.cloud" for the cozy hosted client with the "foobar" account.

func (*HTTPClient) Delete

func (s *HTTPClient) Delete(ctx context.Context, cmd *DeleteCmd) error

func (*HTTPClient) Register

func (s *HTTPClient) Register(ctx context.Context, cmd *RegisterCmd) (*Client, error)

type RegisterCmd

type RegisterCmd struct {
	Domain               string   `json:"-"`
	ClientName           string   `json:"client_name"`
	SoftwareID           string   `json:"software_id"`
	ClientKind           string   `json:"client_kind,omitempty"`
	ClientURI            string   `json:"client_uri,omitempty"`
	LogoURI              string   `json:"logo_uri,omitempty"`
	PolicyURI            string   `json:"policy_uri,omitempty"`
	RedirectURIs         []string `json:"redirect_uris"`
	SecretExpiresAt      int      `json:"client_secret_expires_at"`
	SoftwareVersion      string   `json:"software_version,omitempty"`
	NotificationPlatform string   `json:"notification_platform"`
}

type Storage

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

func NewStorage

func NewStorage(appName string, inst *instance.Instance) *Storage

func (*Storage) Delete

func (s *Storage) Delete(client string) error

func (*Storage) List

func (s *Storage) List() ([]Client, error)

func (*Storage) Load

func (s *Storage) Load(client string) (*Client, error)

func (*Storage) Save

func (s *Storage) Save(client *Client) error

Jump to

Keyboard shortcuts

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