klocka

package module
v0.0.0-...-60e74c1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

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

func (*APIError) Body

func (e *APIError) Body() []byte

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) Status

func (e *APIError) Status() int

func (*APIError) Unwrap

func (e *APIError) Unwrap() error

type Client

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

func NewClient

func NewClient(apiKey, apiSecret string) (*Client, error)

func NewClientWithOpts

func NewClientWithOpts(apiKey, apiSecret string, opts *ClientOpts) (*Client, error)

func (*Client) CreateTask

func (cl *Client) CreateTask(ctx context.Context, spec TaskInput) (*Task, error)

func (*Client) DeleteTask

func (cl *Client) DeleteTask(ctx context.Context, id string) error

func (*Client) GetTask

func (cl *Client) GetTask(ctx context.Context, id string) (*Task, error)

func (*Client) ListTasks

func (cl *Client) ListTasks(ctx context.Context, id string, opts *ListOpts) (*PaginatedResponse, error)

func (*Client) UpdateTask

func (cl *Client) UpdateTask(ctx context.Context, id string, spec TaskInput) (*Task, error)

type ClientOpts

type ClientOpts struct {
	Endpoint string
}

type Duration

type Duration struct {
	time.Duration
}

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() (b []byte, err error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) (err error)

type ListOpts

type ListOpts struct {
	PerPage *uint8
	Page    *int
}

func (*ListOpts) Encode

func (li *ListOpts) Encode() string

type PageInfo

type PageInfo struct{}

type PaginatedResponse

type PaginatedResponse struct {
	Data     []Task
	PageInfo PageInfo `json:"pageInfo"`
}

type Task

type Task struct {
	ID            string            `json:"id"`
	Name          string            `json:"name"`
	MaxDuration   Duration          `json:"maxDuration"`
	URL           string            `json:"url"`
	AllowOverlap  bool              `json:"allowOverlap"`
	Interval      Duration          `json:"interval"`
	Cron          *string           `json:"cron"`
	HttpMethod    string            `json:"httpMethod"`
	HttpHeaders   http.Header       `json:"httpHeaders"`
	RegionID      string            `json:"regionId"`
	Meta          map[string]string `json:"meta"`
	OkStatusCodes []int             `json:"okStatusCodes"`
}

type TaskInput

type TaskInput struct {
	ID            *string           `json:"id,omitempty"`
	Name          string            `json:"name"`
	MaxDuration   Duration          `json:"maxDuration"`
	URL           string            `json:"url"`
	AllowOverlap  bool              `json:"allowOverlap"`
	Interval      Duration          `json:"interval"`
	Cron          *string           `json:"cron"`
	HttpMethod    string            `json:"httpMethod"`
	HttpHeaders   http.Header       `json:"httpHeaders"`
	RegionID      string            `json:"regionId"`
	Meta          map[string]string `json:"meta"`
	OkStatusCodes []int             `json:"okStatusCodes"`
}

Jump to

Keyboard shortcuts

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