Documentation
¶
Index ¶
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- type CreateTaskParam
- type CreateWorkerParam
- type CreateWorkerVisibility
- type Error
- type Task
- type TaskNewParams
- type TaskService
- type TaskStatus
- type TaskTotals
- type TaskTriggeredBy
- type TaskWithTurns
- type TaskWithTurnsTurn
- type Worker
- type WorkerFile
- type WorkerGetEmailResponse
- type WorkerGetParams
- type WorkerGetParamsStream
- type WorkerNewParams
- type WorkerNewResponse
- type WorkerNewResponseVisibility
- type WorkerObject
- type WorkerOutput
- type WorkerOutputContent
- type WorkerScheduleCancelParams
- type WorkerScheduleCancelResponse
- type WorkerScheduleCron
- type WorkerScheduleDelayed
- type WorkerScheduleInterval
- type WorkerScheduleListResponse
- type WorkerScheduleNewParams
- type WorkerScheduleNewParamsBudget
- type WorkerScheduleNewParamsWhenCron
- type WorkerScheduleNewParamsWhenDelayed
- type WorkerScheduleNewParamsWhenInterval
- type WorkerScheduleNewParamsWhenScheduled
- type WorkerScheduleNewParamsWhenUnion
- type WorkerScheduleScheduled
- type WorkerScheduleService
- func (r *WorkerScheduleService) Cancel(ctx context.Context, scheduleID string, body WorkerScheduleCancelParams, ...) (res *WorkerScheduleCancelResponse, err error)
- func (r *WorkerScheduleService) List(ctx context.Context, workerID string, opts ...option.RequestOption) (res *WorkerScheduleListResponse, err error)
- func (r *WorkerScheduleService) New(ctx context.Context, workerID string, body WorkerScheduleNewParams, ...) (res *WorkerScheduleUnion, err error)
- type WorkerScheduleUnion
- func (u WorkerScheduleUnion) AsAny() anyWorkerSchedule
- func (u WorkerScheduleUnion) AsCron() (v WorkerScheduleCron)
- func (u WorkerScheduleUnion) AsDelayed() (v WorkerScheduleDelayed)
- func (u WorkerScheduleUnion) AsInterval() (v WorkerScheduleInterval)
- func (u WorkerScheduleUnion) AsScheduled() (v WorkerScheduleScheduled)
- func (u WorkerScheduleUnion) RawJSON() string
- func (r *WorkerScheduleUnion) UnmarshalJSON(data []byte) error
- type WorkerService
- func (r *WorkerService) Get(ctx context.Context, workerID string, query WorkerGetParams, ...) (res *Worker, err error)
- func (r *WorkerService) GetEmail(ctx context.Context, workerID string, opts ...option.RequestOption) (res *WorkerGetEmailResponse, err error)
- func (r *WorkerService) New(ctx context.Context, body WorkerNewParams, opts ...option.RequestOption) (res *WorkerNewResponse, err error)
- type WorkerSource
- type WorkerStatus
- type WorkerUsage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (HANDINGER_API_KEY, HANDINGER_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type Client ¶
type Client struct {
// Create, retrieve, and manage agent worker templates.
Workers WorkerService
// Run and inspect tasks against a worker.
Tasks TaskService
// contains filtered or unexported fields
}
Client creates a struct with services and top level methods that help with interacting with the handinger API. You should not instantiate this client directly, and instead use the NewClient method instead.
func NewClient ¶
func NewClient(opts ...option.RequestOption) (r Client)
NewClient generates a new client with the default option read from the environment (HANDINGER_API_KEY, HANDINGER_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.
func (*Client) Delete ¶
func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Execute ¶
func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error
Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.
If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.
The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.
If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.
Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.
The response body will be deserialized into the res variable, depending on its type:
- A pointer to a *http.Response is populated by the raw response.
- A pointer to a byte array will be populated with the contents of the request body.
- A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
- A nil value will not read the response body.
For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.
func (*Client) Get ¶
func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Patch ¶
func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
type CreateTaskParam ¶ added in v0.2.0
type CreateTaskParam struct {
// Worker id the task belongs to.
WorkerID string `json:"workerId" api:"required"`
CreateWorkerParam
}
func (CreateTaskParam) MarshalJSON ¶ added in v0.2.0
func (r CreateTaskParam) MarshalJSON() (data []byte, err error)
type CreateWorkerParam ¶
type CreateWorkerParam struct {
// Persistent system prompt the worker uses for every task it runs.
Instructions param.Opt[string] `json:"instructions,omitzero"`
// Natural-language description of the worker to use for AI-generated instructions
// when `instructions` is omitted.
Prompt param.Opt[string] `json:"prompt,omitzero"`
// Optional display name. When omitted, Handinger assigns a random dog-themed name.
Title param.Opt[string] `json:"title,omitzero"`
// `public` (default) is visible to all org members. `private` is only visible to
// invited members.
//
// Any of "public", "private".
Visibility CreateWorkerVisibility `json:"visibility,omitzero"`
// contains filtered or unexported fields
}
func (CreateWorkerParam) MarshalJSON ¶
func (r CreateWorkerParam) MarshalJSON() (data []byte, err error)
func (*CreateWorkerParam) UnmarshalJSON ¶
func (r *CreateWorkerParam) UnmarshalJSON(data []byte) error
type CreateWorkerVisibility ¶ added in v0.2.0
type CreateWorkerVisibility string
`public` (default) is visible to all org members. `private` is only visible to invited members.
const ( CreateWorkerVisibilityPublic CreateWorkerVisibility = "public" CreateWorkerVisibilityPrivate CreateWorkerVisibility = "private" )
type Task ¶ added in v0.2.0
type Task struct {
ID string `json:"id" api:"required"`
CompletedAt string `json:"completedAt" api:"required"`
CreatedAt string `json:"createdAt" api:"required"`
CreatedByUserID string `json:"createdByUserId" api:"required"`
OrganizationID string `json:"organizationId" api:"required"`
// Any of "pending", "running", "completed", "error", "aborted".
Status TaskStatus `json:"status" api:"required"`
Title string `json:"title" api:"required"`
Totals TaskTotals `json:"totals" api:"required"`
// Any of "api", "email", "schedule", "ui".
TriggeredBy TaskTriggeredBy `json:"triggeredBy" api:"required"`
WorkerID string `json:"workerId" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CompletedAt respjson.Field
CreatedAt respjson.Field
CreatedByUserID respjson.Field
OrganizationID respjson.Field
Status respjson.Field
Title respjson.Field
Totals respjson.Field
TriggeredBy respjson.Field
WorkerID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Task) UnmarshalJSON ¶ added in v0.2.0
type TaskNewParams ¶ added in v0.2.0
type TaskNewParams struct {
CreateTask CreateTaskParam
// contains filtered or unexported fields
}
func (TaskNewParams) MarshalJSON ¶ added in v0.2.0
func (r TaskNewParams) MarshalJSON() (data []byte, err error)
func (*TaskNewParams) UnmarshalJSON ¶ added in v0.2.0
func (r *TaskNewParams) UnmarshalJSON(data []byte) error
type TaskService ¶ added in v0.2.0
type TaskService struct {
// contains filtered or unexported fields
}
Run and inspect tasks against a worker.
TaskService contains methods and other services that help with interacting with the handinger API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTaskService method instead.
func NewTaskService ¶ added in v0.2.0
func NewTaskService(opts ...option.RequestOption) (r TaskService)
NewTaskService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*TaskService) Get ¶ added in v0.2.0
func (r *TaskService) Get(ctx context.Context, taskID string, opts ...option.RequestOption) (res *TaskWithTurns, err error)
Retrieve a single task and its individual turns.
func (*TaskService) New ¶ added in v0.2.0
func (r *TaskService) New(ctx context.Context, body TaskNewParams, opts ...option.RequestOption) (res *Worker, err error)
Run a new task against an existing worker. Send `multipart/form-data` to attach files; the bytes are bootstrapped into the worker's workspace before the task starts.
type TaskStatus ¶ added in v0.2.0
type TaskStatus string
const ( TaskStatusPending TaskStatus = "pending" TaskStatusRunning TaskStatus = "running" TaskStatusCompleted TaskStatus = "completed" TaskStatusError TaskStatus = "error" TaskStatusAborted TaskStatus = "aborted" )
type TaskTotals ¶ added in v0.2.0
type TaskTotals struct {
Credits float64 `json:"credits" api:"required"`
DurationMs float64 `json:"durationMs" api:"required"`
TurnCount float64 `json:"turnCount" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Credits respjson.Field
DurationMs respjson.Field
TurnCount respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (TaskTotals) RawJSON ¶ added in v0.2.0
func (r TaskTotals) RawJSON() string
Returns the unmodified JSON received from the API
func (*TaskTotals) UnmarshalJSON ¶ added in v0.2.0
func (r *TaskTotals) UnmarshalJSON(data []byte) error
type TaskTriggeredBy ¶ added in v0.2.0
type TaskTriggeredBy string
const ( TaskTriggeredByAPI TaskTriggeredBy = "api" TaskTriggeredByEmail TaskTriggeredBy = "email" TaskTriggeredBySchedule TaskTriggeredBy = "schedule" TaskTriggeredByUi TaskTriggeredBy = "ui" )
type TaskWithTurns ¶ added in v0.2.0
type TaskWithTurns struct {
Task Task `json:"task" api:"required"`
Turns []TaskWithTurnsTurn `json:"turns" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Task respjson.Field
Turns respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (TaskWithTurns) RawJSON ¶ added in v0.2.0
func (r TaskWithTurns) RawJSON() string
Returns the unmodified JSON received from the API
func (*TaskWithTurns) UnmarshalJSON ¶ added in v0.2.0
func (r *TaskWithTurns) UnmarshalJSON(data []byte) error
type TaskWithTurnsTurn ¶ added in v0.2.0
type TaskWithTurnsTurn struct {
ID string `json:"id" api:"required"`
CompletedAt string `json:"completedAt" api:"required"`
Credits float64 `json:"credits" api:"required"`
DurationMs int64 `json:"durationMs" api:"required"`
Input string `json:"input" api:"required"`
InputTokens int64 `json:"inputTokens" api:"required"`
OutputText string `json:"outputText" api:"required"`
OutputTokens int64 `json:"outputTokens" api:"required"`
Role string `json:"role" api:"required"`
Seq int64 `json:"seq" api:"required"`
StartedAt string `json:"startedAt" api:"required"`
Status string `json:"status" api:"required"`
TaskID string `json:"taskId" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CompletedAt respjson.Field
Credits respjson.Field
DurationMs respjson.Field
Input respjson.Field
InputTokens respjson.Field
OutputText respjson.Field
OutputTokens respjson.Field
Role respjson.Field
Seq respjson.Field
StartedAt respjson.Field
Status respjson.Field
TaskID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (TaskWithTurnsTurn) RawJSON ¶ added in v0.2.0
func (r TaskWithTurnsTurn) RawJSON() string
Returns the unmodified JSON received from the API
func (*TaskWithTurnsTurn) UnmarshalJSON ¶ added in v0.2.0
func (r *TaskWithTurnsTurn) UnmarshalJSON(data []byte) error
type Worker ¶
type Worker struct {
ID string `json:"id" api:"required"`
CreatedAt int64 `json:"created_at" api:"required"`
Error any `json:"error" api:"required"`
Files []WorkerFile `json:"files" api:"required"`
IncompleteDetails any `json:"incomplete_details" api:"required"`
Messages []any `json:"messages" api:"required"`
Metadata map[string]any `json:"metadata" api:"required"`
// Any of "worker".
Object WorkerObject `json:"object" api:"required"`
Output []WorkerOutput `json:"output" api:"required"`
OutputText string `json:"output_text" api:"required"`
Running bool `json:"running" api:"required"`
Sources []WorkerSource `json:"sources" api:"required"`
// Any of "running", "completed", "pending".
Status WorkerStatus `json:"status" api:"required"`
Usage WorkerUsage `json:"usage"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Error respjson.Field
Files respjson.Field
IncompleteDetails respjson.Field
Messages respjson.Field
Metadata respjson.Field
Object respjson.Field
Output respjson.Field
OutputText respjson.Field
Running respjson.Field
Sources respjson.Field
Status respjson.Field
Usage respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Worker) UnmarshalJSON ¶
type WorkerFile ¶
type WorkerFile struct {
Filename string `json:"filename" api:"required"`
MediaType string `json:"mediaType" api:"required"`
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Filename respjson.Field
MediaType respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WorkerFile) RawJSON ¶
func (r WorkerFile) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerFile) UnmarshalJSON ¶
func (r *WorkerFile) UnmarshalJSON(data []byte) error
type WorkerGetEmailResponse ¶ added in v0.5.0
type WorkerGetEmailResponse struct {
Email string `json:"email" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Email respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WorkerGetEmailResponse) RawJSON ¶ added in v0.5.0
func (r WorkerGetEmailResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerGetEmailResponse) UnmarshalJSON ¶ added in v0.5.0
func (r *WorkerGetEmailResponse) UnmarshalJSON(data []byte) error
type WorkerGetParams ¶
type WorkerGetParams struct {
// Set to "true" to receive a server-sent event stream that replays all stored
// messages and then continues with live chunks from the active task (if any)
// before closing.
//
// Any of "true", "false".
Stream WorkerGetParamsStream `query:"stream,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (WorkerGetParams) URLQuery ¶
func (r WorkerGetParams) URLQuery() (v url.Values, err error)
URLQuery serializes WorkerGetParams's query parameters as `url.Values`.
type WorkerGetParamsStream ¶ added in v0.1.0
type WorkerGetParamsStream string
Set to "true" to receive a server-sent event stream that replays all stored messages and then continues with live chunks from the active task (if any) before closing.
const ( WorkerGetParamsStreamTrue WorkerGetParamsStream = "true" WorkerGetParamsStreamFalse WorkerGetParamsStream = "false" )
type WorkerNewParams ¶
type WorkerNewParams struct {
CreateWorker CreateWorkerParam
// contains filtered or unexported fields
}
func (WorkerNewParams) MarshalJSON ¶
func (r WorkerNewParams) MarshalJSON() (data []byte, err error)
func (*WorkerNewParams) UnmarshalJSON ¶
func (r *WorkerNewParams) UnmarshalJSON(data []byte) error
type WorkerNewResponse ¶ added in v0.2.0
type WorkerNewResponse struct {
ID string `json:"id" api:"required"`
CreatedAt string `json:"createdAt" api:"required"`
Instructions string `json:"instructions" api:"required"`
OrganizationID string `json:"organizationId" api:"required"`
Title string `json:"title" api:"required"`
UpdatedAt string `json:"updatedAt" api:"required"`
UserID string `json:"userId" api:"required"`
// Any of "public", "private".
Visibility WorkerNewResponseVisibility `json:"visibility" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Instructions respjson.Field
OrganizationID respjson.Field
Title respjson.Field
UpdatedAt respjson.Field
UserID respjson.Field
Visibility respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WorkerNewResponse) RawJSON ¶ added in v0.2.0
func (r WorkerNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerNewResponse) UnmarshalJSON ¶ added in v0.2.0
func (r *WorkerNewResponse) UnmarshalJSON(data []byte) error
type WorkerNewResponseVisibility ¶ added in v0.2.0
type WorkerNewResponseVisibility string
const ( WorkerNewResponseVisibilityPublic WorkerNewResponseVisibility = "public" WorkerNewResponseVisibilityPrivate WorkerNewResponseVisibility = "private" )
type WorkerOutput ¶
type WorkerOutput struct {
ID string `json:"id" api:"required"`
Content []WorkerOutputContent `json:"content" api:"required"`
// Any of "assistant".
Role string `json:"role" api:"required"`
// Any of "completed".
Status string `json:"status" api:"required"`
// Any of "message".
Type string `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Content respjson.Field
Role respjson.Field
Status respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WorkerOutput) RawJSON ¶
func (r WorkerOutput) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerOutput) UnmarshalJSON ¶
func (r *WorkerOutput) UnmarshalJSON(data []byte) error
type WorkerOutputContent ¶
type WorkerOutputContent struct {
Text string `json:"text" api:"required"`
// Any of "output_text".
Type string `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Text respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WorkerOutputContent) RawJSON ¶
func (r WorkerOutputContent) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerOutputContent) UnmarshalJSON ¶
func (r *WorkerOutputContent) UnmarshalJSON(data []byte) error
type WorkerScheduleCancelParams ¶
type WorkerScheduleCancelParams struct {
WorkerID string `path:"workerId" api:"required" json:"-"`
// contains filtered or unexported fields
}
type WorkerScheduleCancelResponse ¶
type WorkerScheduleCancelResponse struct {
Cancelled bool `json:"cancelled" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Cancelled respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WorkerScheduleCancelResponse) RawJSON ¶
func (r WorkerScheduleCancelResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerScheduleCancelResponse) UnmarshalJSON ¶
func (r *WorkerScheduleCancelResponse) UnmarshalJSON(data []byte) error
type WorkerScheduleCron ¶ added in v0.1.0
type WorkerScheduleCron struct {
ID string `json:"id" api:"required"`
// Any of "low", "standard", "high", "unlimited".
Budget string `json:"budget" api:"required"`
Cron string `json:"cron" api:"required"`
Input string `json:"input" api:"required"`
NextRunAt time.Time `json:"nextRunAt" api:"required" format:"date-time"`
Type constant.Cron `json:"type" default:"cron"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Budget respjson.Field
Cron respjson.Field
Input respjson.Field
NextRunAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WorkerScheduleCron) RawJSON ¶ added in v0.1.0
func (r WorkerScheduleCron) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerScheduleCron) UnmarshalJSON ¶ added in v0.1.0
func (r *WorkerScheduleCron) UnmarshalJSON(data []byte) error
type WorkerScheduleDelayed ¶ added in v0.1.0
type WorkerScheduleDelayed struct {
ID string `json:"id" api:"required"`
// Any of "low", "standard", "high", "unlimited".
Budget string `json:"budget" api:"required"`
DelayInSeconds int64 `json:"delayInSeconds" api:"required"`
Input string `json:"input" api:"required"`
NextRunAt time.Time `json:"nextRunAt" api:"required" format:"date-time"`
Type constant.Delayed `json:"type" default:"delayed"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Budget respjson.Field
DelayInSeconds respjson.Field
Input respjson.Field
NextRunAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WorkerScheduleDelayed) RawJSON ¶ added in v0.1.0
func (r WorkerScheduleDelayed) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerScheduleDelayed) UnmarshalJSON ¶ added in v0.1.0
func (r *WorkerScheduleDelayed) UnmarshalJSON(data []byte) error
type WorkerScheduleInterval ¶ added in v0.1.0
type WorkerScheduleInterval struct {
ID string `json:"id" api:"required"`
// Any of "low", "standard", "high", "unlimited".
Budget string `json:"budget" api:"required"`
Input string `json:"input" api:"required"`
IntervalSeconds int64 `json:"intervalSeconds" api:"required"`
NextRunAt time.Time `json:"nextRunAt" api:"required" format:"date-time"`
Type constant.Interval `json:"type" default:"interval"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Budget respjson.Field
Input respjson.Field
IntervalSeconds respjson.Field
NextRunAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WorkerScheduleInterval) RawJSON ¶ added in v0.1.0
func (r WorkerScheduleInterval) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerScheduleInterval) UnmarshalJSON ¶ added in v0.1.0
func (r *WorkerScheduleInterval) UnmarshalJSON(data []byte) error
type WorkerScheduleListResponse ¶
type WorkerScheduleListResponse struct {
Schedules []WorkerScheduleUnion `json:"schedules" api:"required"`
WorkerID string `json:"workerId" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Schedules respjson.Field
WorkerID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WorkerScheduleListResponse) RawJSON ¶
func (r WorkerScheduleListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerScheduleListResponse) UnmarshalJSON ¶
func (r *WorkerScheduleListResponse) UnmarshalJSON(data []byte) error
type WorkerScheduleNewParams ¶
type WorkerScheduleNewParams struct {
Input string `json:"input" api:"required"`
When WorkerScheduleNewParamsWhenUnion `json:"when,omitzero" api:"required"`
// Any of "low", "standard", "high", "unlimited".
Budget WorkerScheduleNewParamsBudget `json:"budget,omitzero"`
// contains filtered or unexported fields
}
func (WorkerScheduleNewParams) MarshalJSON ¶
func (r WorkerScheduleNewParams) MarshalJSON() (data []byte, err error)
func (*WorkerScheduleNewParams) UnmarshalJSON ¶
func (r *WorkerScheduleNewParams) UnmarshalJSON(data []byte) error
type WorkerScheduleNewParamsBudget ¶
type WorkerScheduleNewParamsBudget string
const ( WorkerScheduleNewParamsBudgetLow WorkerScheduleNewParamsBudget = "low" WorkerScheduleNewParamsBudgetStandard WorkerScheduleNewParamsBudget = "standard" WorkerScheduleNewParamsBudgetHigh WorkerScheduleNewParamsBudget = "high" WorkerScheduleNewParamsBudgetUnlimited WorkerScheduleNewParamsBudget = "unlimited" )
type WorkerScheduleNewParamsWhenCron ¶ added in v0.1.0
type WorkerScheduleNewParamsWhenCron struct {
Cron string `json:"cron" api:"required"`
// This field can be elided, and will marshal its zero value as "cron".
Type constant.Cron `json:"type" default:"cron"`
// contains filtered or unexported fields
}
The properties Cron, Type are required.
func (WorkerScheduleNewParamsWhenCron) MarshalJSON ¶ added in v0.1.0
func (r WorkerScheduleNewParamsWhenCron) MarshalJSON() (data []byte, err error)
func (*WorkerScheduleNewParamsWhenCron) UnmarshalJSON ¶ added in v0.1.0
func (r *WorkerScheduleNewParamsWhenCron) UnmarshalJSON(data []byte) error
type WorkerScheduleNewParamsWhenDelayed ¶ added in v0.1.0
type WorkerScheduleNewParamsWhenDelayed struct {
DelayInSeconds int64 `json:"delayInSeconds" api:"required"`
// This field can be elided, and will marshal its zero value as "delayed".
Type constant.Delayed `json:"type" default:"delayed"`
// contains filtered or unexported fields
}
The properties DelayInSeconds, Type are required.
func (WorkerScheduleNewParamsWhenDelayed) MarshalJSON ¶ added in v0.1.0
func (r WorkerScheduleNewParamsWhenDelayed) MarshalJSON() (data []byte, err error)
func (*WorkerScheduleNewParamsWhenDelayed) UnmarshalJSON ¶ added in v0.1.0
func (r *WorkerScheduleNewParamsWhenDelayed) UnmarshalJSON(data []byte) error
type WorkerScheduleNewParamsWhenInterval ¶ added in v0.1.0
type WorkerScheduleNewParamsWhenInterval struct {
IntervalSeconds int64 `json:"intervalSeconds" api:"required"`
// This field can be elided, and will marshal its zero value as "interval".
Type constant.Interval `json:"type" default:"interval"`
// contains filtered or unexported fields
}
The properties IntervalSeconds, Type are required.
func (WorkerScheduleNewParamsWhenInterval) MarshalJSON ¶ added in v0.1.0
func (r WorkerScheduleNewParamsWhenInterval) MarshalJSON() (data []byte, err error)
func (*WorkerScheduleNewParamsWhenInterval) UnmarshalJSON ¶ added in v0.1.0
func (r *WorkerScheduleNewParamsWhenInterval) UnmarshalJSON(data []byte) error
type WorkerScheduleNewParamsWhenScheduled ¶ added in v0.1.0
type WorkerScheduleNewParamsWhenScheduled struct {
Date time.Time `json:"date" api:"required" format:"date-time"`
// This field can be elided, and will marshal its zero value as "scheduled".
Type constant.Scheduled `json:"type" default:"scheduled"`
// contains filtered or unexported fields
}
The properties Date, Type are required.
func (WorkerScheduleNewParamsWhenScheduled) MarshalJSON ¶ added in v0.1.0
func (r WorkerScheduleNewParamsWhenScheduled) MarshalJSON() (data []byte, err error)
func (*WorkerScheduleNewParamsWhenScheduled) UnmarshalJSON ¶ added in v0.1.0
func (r *WorkerScheduleNewParamsWhenScheduled) UnmarshalJSON(data []byte) error
type WorkerScheduleNewParamsWhenUnion ¶
type WorkerScheduleNewParamsWhenUnion struct {
OfScheduled *WorkerScheduleNewParamsWhenScheduled `json:",omitzero,inline"`
OfDelayed *WorkerScheduleNewParamsWhenDelayed `json:",omitzero,inline"`
OfCron *WorkerScheduleNewParamsWhenCron `json:",omitzero,inline"`
OfInterval *WorkerScheduleNewParamsWhenInterval `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (WorkerScheduleNewParamsWhenUnion) MarshalJSON ¶
func (u WorkerScheduleNewParamsWhenUnion) MarshalJSON() ([]byte, error)
func (*WorkerScheduleNewParamsWhenUnion) UnmarshalJSON ¶
func (u *WorkerScheduleNewParamsWhenUnion) UnmarshalJSON(data []byte) error
type WorkerScheduleScheduled ¶ added in v0.1.0
type WorkerScheduleScheduled struct {
ID string `json:"id" api:"required"`
// Any of "low", "standard", "high", "unlimited".
Budget string `json:"budget" api:"required"`
Input string `json:"input" api:"required"`
NextRunAt time.Time `json:"nextRunAt" api:"required" format:"date-time"`
Type constant.Scheduled `json:"type" default:"scheduled"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Budget respjson.Field
Input respjson.Field
NextRunAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WorkerScheduleScheduled) RawJSON ¶ added in v0.1.0
func (r WorkerScheduleScheduled) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerScheduleScheduled) UnmarshalJSON ¶ added in v0.1.0
func (r *WorkerScheduleScheduled) UnmarshalJSON(data []byte) error
type WorkerScheduleService ¶
type WorkerScheduleService struct {
// contains filtered or unexported fields
}
Manage future and recurring worker tasks.
WorkerScheduleService contains methods and other services that help with interacting with the handinger API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWorkerScheduleService method instead.
func NewWorkerScheduleService ¶
func NewWorkerScheduleService(opts ...option.RequestOption) (r WorkerScheduleService)
NewWorkerScheduleService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*WorkerScheduleService) Cancel ¶
func (r *WorkerScheduleService) Cancel(ctx context.Context, scheduleID string, body WorkerScheduleCancelParams, opts ...option.RequestOption) (res *WorkerScheduleCancelResponse, err error)
Cancel a scheduled task for a worker.
func (*WorkerScheduleService) List ¶
func (r *WorkerScheduleService) List(ctx context.Context, workerID string, opts ...option.RequestOption) (res *WorkerScheduleListResponse, err error)
List scheduled tasks for a worker.
func (*WorkerScheduleService) New ¶
func (r *WorkerScheduleService) New(ctx context.Context, workerID string, body WorkerScheduleNewParams, opts ...option.RequestOption) (res *WorkerScheduleUnion, err error)
Schedule a worker instruction for a future or recurring run.
type WorkerScheduleUnion ¶
type WorkerScheduleUnion struct {
ID string `json:"id"`
Budget string `json:"budget"`
Input string `json:"input"`
NextRunAt time.Time `json:"nextRunAt"`
// Any of "scheduled", "delayed", "cron", "interval".
Type string `json:"type"`
// This field is from variant [WorkerScheduleDelayed].
DelayInSeconds int64 `json:"delayInSeconds"`
// This field is from variant [WorkerScheduleCron].
Cron string `json:"cron"`
// This field is from variant [WorkerScheduleInterval].
IntervalSeconds int64 `json:"intervalSeconds"`
JSON struct {
ID respjson.Field
Budget respjson.Field
Input respjson.Field
NextRunAt respjson.Field
Type respjson.Field
DelayInSeconds respjson.Field
Cron respjson.Field
IntervalSeconds respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WorkerScheduleUnion contains all possible properties and values from WorkerScheduleScheduled, WorkerScheduleDelayed, WorkerScheduleCron, WorkerScheduleInterval.
Use the WorkerScheduleUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (WorkerScheduleUnion) AsAny ¶ added in v0.1.0
func (u WorkerScheduleUnion) AsAny() anyWorkerSchedule
Use the following switch statement to find the correct variant
switch variant := WorkerScheduleUnion.AsAny().(type) {
case handinger.WorkerScheduleScheduled:
case handinger.WorkerScheduleDelayed:
case handinger.WorkerScheduleCron:
case handinger.WorkerScheduleInterval:
default:
fmt.Errorf("no variant present")
}
func (WorkerScheduleUnion) AsCron ¶ added in v0.1.0
func (u WorkerScheduleUnion) AsCron() (v WorkerScheduleCron)
func (WorkerScheduleUnion) AsDelayed ¶ added in v0.1.0
func (u WorkerScheduleUnion) AsDelayed() (v WorkerScheduleDelayed)
func (WorkerScheduleUnion) AsInterval ¶ added in v0.1.0
func (u WorkerScheduleUnion) AsInterval() (v WorkerScheduleInterval)
func (WorkerScheduleUnion) AsScheduled ¶ added in v0.1.0
func (u WorkerScheduleUnion) AsScheduled() (v WorkerScheduleScheduled)
func (WorkerScheduleUnion) RawJSON ¶
func (u WorkerScheduleUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerScheduleUnion) UnmarshalJSON ¶
func (r *WorkerScheduleUnion) UnmarshalJSON(data []byte) error
type WorkerService ¶
type WorkerService struct {
// Manage future and recurring worker tasks.
Schedules WorkerScheduleService
// contains filtered or unexported fields
}
Create, retrieve, and manage agent worker templates.
WorkerService contains methods and other services that help with interacting with the handinger API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWorkerService method instead.
func NewWorkerService ¶
func NewWorkerService(opts ...option.RequestOption) (r WorkerService)
NewWorkerService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*WorkerService) Get ¶
func (r *WorkerService) Get(ctx context.Context, workerID string, query WorkerGetParams, opts ...option.RequestOption) (res *Worker, err error)
Retrieve the current worker state and messages from its most recent task. Returns a JSON worker object by default, or a server-sent event stream when `stream=true`.
func (*WorkerService) GetEmail ¶
func (r *WorkerService) GetEmail(ctx context.Context, workerID string, opts ...option.RequestOption) (res *WorkerGetEmailResponse, err error)
Retrieve the inbound email address for a worker.
func (*WorkerService) New ¶
func (r *WorkerService) New(ctx context.Context, body WorkerNewParams, opts ...option.RequestOption) (res *WorkerNewResponse, err error)
Create a new worker. The worker is a reusable agent template; tasks are runs against this template. Use `POST /tasks` to actually run the agent.
type WorkerSource ¶
type WorkerSource struct {
ID string `json:"id" api:"required"`
Title string `json:"title" api:"required"`
// Any of "url".
Type string `json:"type" api:"required"`
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Title respjson.Field
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WorkerSource) RawJSON ¶
func (r WorkerSource) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerSource) UnmarshalJSON ¶
func (r *WorkerSource) UnmarshalJSON(data []byte) error
type WorkerStatus ¶
type WorkerStatus string
const ( WorkerStatusRunning WorkerStatus = "running" WorkerStatusCompleted WorkerStatus = "completed" WorkerStatusPending WorkerStatus = "pending" )
type WorkerUsage ¶
type WorkerUsage struct {
Credits int64 `json:"credits"`
DurationMs int64 `json:"durationMs"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Credits respjson.Field
DurationMs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WorkerUsage) RawJSON ¶
func (r WorkerUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*WorkerUsage) UnmarshalJSON ¶
func (r *WorkerUsage) UnmarshalJSON(data []byte) error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
|
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package. |
|
packages
|
|
|
shared
|
|