patchyc

package module
v0.0.0-...-e3f02ac Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound            = fmt.Errorf("not found")
	ErrMultipleFound       = fmt.Errorf("multiple found")
	ErrInvalidStreamEvent  = fmt.Errorf("invalid stream event")
	ErrInvalidStreamFormat = fmt.Errorf("invalid stream format")
)

Functions

func Create

func Create[T any](ctx context.Context, c *Client, obj *T) (*T, error)

func CreateName

func CreateName[T any](ctx context.Context, c *Client, name string, obj *T) (*T, error)

func Delete

func Delete[T any](ctx context.Context, c *Client, id string, opts *UpdateOpts) error

func DeleteName

func DeleteName[T any](ctx context.Context, c *Client, name, id string, opts *UpdateOpts) error

func Find

func Find[T any](ctx context.Context, c *Client, shortID string) (*T, error)

func FindName

func FindName[T any](ctx context.Context, c *Client, name, shortID string) (*T, error)

func Get

func Get[T any](ctx context.Context, c *Client, id string, opts *GetOpts) (*T, error)

func GetName

func GetName[T any](ctx context.Context, c *Client, name, id string, opts *GetOpts) (*T, error)

func List

func List[T any](ctx context.Context, c *Client, opts *ListOpts) ([]*T, error)

func ListName

func ListName[T any](ctx context.Context, c *Client, name string, opts *ListOpts) ([]*T, error)

func Replace

func Replace[T any](ctx context.Context, c *Client, id string, obj *T, opts *UpdateOpts) (*T, error)

func ReplaceName

func ReplaceName[T any](ctx context.Context, c *Client, name, id string, obj *T, opts *UpdateOpts) (*T, error)

func Update

func Update[T any](ctx context.Context, c *Client, id string, obj *T, opts *UpdateOpts) (*T, error)

func UpdateName

func UpdateName[T any](ctx context.Context, c *Client, name, id string, obj *T, opts *UpdateOpts) (*T, error)

Types

type Client

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

func NewClient

func NewClient(baseURL string) *Client

func (*Client) DebugInfo

func (c *Client) DebugInfo(ctx context.Context) (map[string]any, error)

func (*Client) GoClient

func (c *Client) GoClient(ctx context.Context) (string, error)

func (*Client) OpenAPI

func (c *Client) OpenAPI(ctx context.Context) (map[string]any, error)

func (*Client) ResetAuth

func (c *Client) ResetAuth() *Client

func (*Client) SetAuthToken

func (c *Client) SetAuthToken(token string) *Client

func (*Client) SetBasicAuth

func (c *Client) SetBasicAuth(user, pass string) *Client

func (*Client) SetDebug

func (c *Client) SetDebug(debug bool) *Client

func (*Client) SetHeader

func (c *Client) SetHeader(header, value string) *Client

func (*Client) SetTLSClientConfig

func (c *Client) SetTLSClientConfig(cfg *tls.Config) *Client

func (*Client) TSClient

func (c *Client) TSClient(ctx context.Context) (string, error)

type Filter

type Filter struct {
	Path  string
	Op    string
	Value string
}

type GetOpts

type GetOpts struct {
	Prev any
}

type GetStream

type GetStream[T any] struct {
	// contains filtered or unexported fields
}

func StreamGet

func StreamGet[T any](ctx context.Context, c *Client, id string, opts *GetOpts) (*GetStream[T], error)

func StreamGetName

func StreamGetName[T any](ctx context.Context, c *Client, name, id string, opts *GetOpts) (*GetStream[T], error)

func (*GetStream[T]) Chan

func (gs *GetStream[T]) Chan() <-chan *T

func (*GetStream[T]) Close

func (gs *GetStream[T]) Close()

func (*GetStream[T]) Error

func (gs *GetStream[T]) Error() error

func (*GetStream[T]) LastEventReceived

func (gs *GetStream[T]) LastEventReceived() time.Time

func (*GetStream[T]) Read

func (gs *GetStream[T]) Read() *T

type ListOpts

type ListOpts struct {
	Stream  string
	Limit   int64
	Offset  int64
	After   string
	Sorts   []string
	Filters []Filter

	Prev any
}

type ListStream

type ListStream[T any] struct {
	// contains filtered or unexported fields
}

func StreamList

func StreamList[T any](ctx context.Context, c *Client, opts *ListOpts) (*ListStream[T], error)

func StreamListName

func StreamListName[T any](ctx context.Context, c *Client, name string, opts *ListOpts) (*ListStream[T], error)

func (*ListStream[T]) Chan

func (ls *ListStream[T]) Chan() <-chan []*T

func (*ListStream[T]) Close

func (ls *ListStream[T]) Close()

func (*ListStream[T]) Error

func (ls *ListStream[T]) Error() error

func (*ListStream[T]) LastEventReceived

func (ls *ListStream[T]) LastEventReceived() time.Time

func (*ListStream[T]) Read

func (ls *ListStream[T]) Read() []*T

type UpdateOpts

type UpdateOpts struct {
	Prev any
}

Jump to

Keyboard shortcuts

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