internal

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToString

func ToString(o interface{}) string

Types

type Api added in v0.4.0

type Api interface {
	// WaitForResourceId will poll the task, waiting for the task to finish processing, where it will then return.
	// An error will be returned if the task couldn't be retrieved or the task was not processed successfully.
	//
	// The task will be continuously polled until the task either fails or succeeds - cancellation can be achieved
	// by cancelling the context.
	WaitForResourceId(ctx context.Context, id string) (int, error)

	// Wait will poll the task, waiting for the task to finish processing, where it will then return.
	// An error will be returned if the task couldn't be retrieved or the task was not processed successfully.
	//
	// The task will be continuously polled until the task either fails or succeeds - cancellation can be achieved
	// by cancelling the context.
	Wait(ctx context.Context, id string) error

	// WaitForResource will poll the task, waiting for the task to finish processing, where it will then marshal the
	// returned resource into the value pointed to be `resource`.
	//
	// The task will be continuously polled until the task either fails or succeeds - cancellation can be achieved
	// by cancelling the context.
	WaitForResource(ctx context.Context, id string, resource interface{}) error
}

func NewAPI

func NewAPI(client *HttpClient, logger Log) Api

type Error

type Error struct {
	Type        *string `json:"type,omitempty"`
	Description *string `json:"description,omitempty"`
	Status      *string `json:"status,omitempty"`
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) StatusCode

func (e *Error) StatusCode() string

func (Error) String

func (o Error) String() string

type HTTPError

type HTTPError struct {
	Name       string
	StatusCode int
	Body       []byte
}

func (*HTTPError) Error

func (h *HTTPError) Error() string

type HttpClient

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

func NewHttpClient

func NewHttpClient(client *http.Client, baseUrl string) (*HttpClient, error)

func (*HttpClient) Delete

func (c *HttpClient) Delete(ctx context.Context, name, path string, responseBody interface{}) error

func (*HttpClient) DeleteWithQuery added in v0.1.11

func (c *HttpClient) DeleteWithQuery(ctx context.Context, name, path string, requestBody interface{}, responseBody interface{}) error

func (*HttpClient) Get

func (c *HttpClient) Get(ctx context.Context, name, path string, responseBody interface{}) error

func (*HttpClient) GetWithQuery

func (c *HttpClient) GetWithQuery(ctx context.Context, name, path string, query url.Values, responseBody interface{}) error

func (*HttpClient) Post

func (c *HttpClient) Post(ctx context.Context, name, path string, requestBody interface{}, responseBody interface{}) error

func (*HttpClient) Put

func (c *HttpClient) Put(ctx context.Context, name, path string, requestBody interface{}, responseBody interface{}) error

type Log

type Log interface {
	Println(v ...interface{})
}

type TaskResponse added in v0.5.0

type TaskResponse struct {
	ID *string `json:"taskId,omitempty"`
}

TaskResponse is the high-level response when a Create/Update/Delete operation is in progress.

func (TaskResponse) String added in v0.5.0

func (o TaskResponse) String() string

Jump to

Keyboard shortcuts

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