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 AppDeploymentFollowResponseLog
- type AppDeploymentFollowResponseState
- type AppDeploymentFollowResponseStateUpdate
- type AppDeploymentFollowResponseUnion
- func (u AppDeploymentFollowResponseUnion) AsAny() anyAppDeploymentFollowResponse
- func (u AppDeploymentFollowResponseUnion) AsLog() (v AppDeploymentFollowResponseLog)
- func (u AppDeploymentFollowResponseUnion) AsState() (v AppDeploymentFollowResponseState)
- func (u AppDeploymentFollowResponseUnion) AsStateUpdate() (v AppDeploymentFollowResponseStateUpdate)
- func (u AppDeploymentFollowResponseUnion) RawJSON() string
- func (r *AppDeploymentFollowResponseUnion) UnmarshalJSON(data []byte) error
- type AppDeploymentNewParams
- type AppDeploymentNewParamsRegion
- type AppDeploymentNewResponse
- type AppDeploymentNewResponseApp
- type AppDeploymentNewResponseAppAction
- type AppDeploymentNewResponseStatus
- type AppDeploymentService
- func (r *AppDeploymentService) FollowStreaming(ctx context.Context, id string, opts ...option.RequestOption) (stream *ssestream.Stream[[]AppDeploymentFollowResponseUnion])
- func (r *AppDeploymentService) New(ctx context.Context, body AppDeploymentNewParams, opts ...option.RequestOption) (res *AppDeploymentNewResponse, err error)
- type AppInvocationGetResponse
- type AppInvocationGetResponseStatus
- type AppInvocationNewParams
- type AppInvocationNewResponse
- type AppInvocationNewResponseStatus
- type AppInvocationService
- type AppListParams
- type AppListResponse
- type AppService
- type BrowserGetResponse
- type BrowserNewParams
- type BrowserNewResponse
- type BrowserService
- 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 Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (KERNEL_API_KEY, KERNEL_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type AppDeploymentFollowResponseLog ¶
type AppDeploymentFollowResponseLog struct { // Event type identifier (always "log"). Event constant.Log `json:"event,required"` // Log message text. Message string `json:"message,required"` // Time the log entry was produced. Timestamp time.Time `json:"timestamp" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Event respjson.Field Message respjson.Field Timestamp respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
A log entry from the application.
func (AppDeploymentFollowResponseLog) RawJSON ¶
func (r AppDeploymentFollowResponseLog) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppDeploymentFollowResponseLog) UnmarshalJSON ¶
func (r *AppDeploymentFollowResponseLog) UnmarshalJSON(data []byte) error
type AppDeploymentFollowResponseState ¶
type AppDeploymentFollowResponseState struct { // Event type identifier (always "state"). Event constant.State `json:"event,required"` // Current application state (e.g., "deploying", "running", "succeeded", "failed"). State string `json:"state,required"` // Time the state was reported. Timestamp time.Time `json:"timestamp" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Event respjson.Field State respjson.Field Timestamp respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
Initial state of the application, emitted once when subscribing.
func (AppDeploymentFollowResponseState) RawJSON ¶
func (r AppDeploymentFollowResponseState) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppDeploymentFollowResponseState) UnmarshalJSON ¶
func (r *AppDeploymentFollowResponseState) UnmarshalJSON(data []byte) error
type AppDeploymentFollowResponseStateUpdate ¶
type AppDeploymentFollowResponseStateUpdate struct { // Event type identifier (always "state_update"). Event constant.StateUpdate `json:"event,required"` // New application state (e.g., "running", "succeeded", "failed"). State string `json:"state,required"` // Time the state change occurred. Timestamp time.Time `json:"timestamp" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Event respjson.Field State respjson.Field Timestamp respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
An update emitted when the application's state changes.
func (AppDeploymentFollowResponseStateUpdate) RawJSON ¶
func (r AppDeploymentFollowResponseStateUpdate) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppDeploymentFollowResponseStateUpdate) UnmarshalJSON ¶
func (r *AppDeploymentFollowResponseStateUpdate) UnmarshalJSON(data []byte) error
type AppDeploymentFollowResponseUnion ¶
type AppDeploymentFollowResponseUnion struct { // Any of "state", "state_update", "log". Event string `json:"event"` State string `json:"state"` Timestamp time.Time `json:"timestamp"` // This field is from variant [AppDeploymentFollowResponseLog]. Message string `json:"message"` JSON struct { Event respjson.Field State respjson.Field Timestamp respjson.Field Message respjson.Field // contains filtered or unexported fields } `json:"-"` }
AppDeploymentFollowResponseUnion contains all possible properties and values from AppDeploymentFollowResponseState, AppDeploymentFollowResponseStateUpdate, AppDeploymentFollowResponseLog.
Use the AppDeploymentFollowResponseUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (AppDeploymentFollowResponseUnion) AsAny ¶
func (u AppDeploymentFollowResponseUnion) AsAny() anyAppDeploymentFollowResponse
Use the following switch statement to find the correct variant
switch variant := AppDeploymentFollowResponseUnion.AsAny().(type) { case kernel.AppDeploymentFollowResponseState: case kernel.AppDeploymentFollowResponseStateUpdate: case kernel.AppDeploymentFollowResponseLog: default: fmt.Errorf("no variant present") }
func (AppDeploymentFollowResponseUnion) AsLog ¶
func (u AppDeploymentFollowResponseUnion) AsLog() (v AppDeploymentFollowResponseLog)
func (AppDeploymentFollowResponseUnion) AsState ¶
func (u AppDeploymentFollowResponseUnion) AsState() (v AppDeploymentFollowResponseState)
func (AppDeploymentFollowResponseUnion) AsStateUpdate ¶
func (u AppDeploymentFollowResponseUnion) AsStateUpdate() (v AppDeploymentFollowResponseStateUpdate)
func (AppDeploymentFollowResponseUnion) RawJSON ¶
func (u AppDeploymentFollowResponseUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppDeploymentFollowResponseUnion) UnmarshalJSON ¶
func (r *AppDeploymentFollowResponseUnion) UnmarshalJSON(data []byte) error
type AppDeploymentNewParams ¶
type AppDeploymentNewParams struct { // Relative path to the entrypoint of the application EntrypointRelPath string `json:"entrypoint_rel_path,required"` // ZIP file containing the application source directory File io.Reader `json:"file,omitzero,required" format:"binary"` // Allow overwriting an existing app version Force param.Opt[bool] `json:"force,omitzero"` // Version of the application. Can be any string. Version param.Opt[string] `json:"version,omitzero"` // Map of environment variables to set for the deployed application. Each key-value // pair represents an environment variable. EnvVars map[string]string `json:"env_vars,omitzero"` // Region for deployment. Currently we only support "aws.us-east-1a" // // Any of "aws.us-east-1a". Region AppDeploymentNewParamsRegion `json:"region,omitzero"` // contains filtered or unexported fields }
func (AppDeploymentNewParams) MarshalMultipart ¶
func (r AppDeploymentNewParams) MarshalMultipart() (data []byte, contentType string, err error)
type AppDeploymentNewParamsRegion ¶
type AppDeploymentNewParamsRegion string
Region for deployment. Currently we only support "aws.us-east-1a"
const (
AppDeploymentNewParamsRegionAwsUsEast1a AppDeploymentNewParamsRegion = "aws.us-east-1a"
)
type AppDeploymentNewResponse ¶
type AppDeploymentNewResponse struct { // List of apps deployed Apps []AppDeploymentNewResponseApp `json:"apps,required"` // Current status of the deployment // // Any of "queued", "deploying", "succeeded", "failed". Status AppDeploymentNewResponseStatus `json:"status,required"` // Status reason StatusReason string `json:"status_reason"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Apps respjson.Field Status respjson.Field StatusReason respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (AppDeploymentNewResponse) RawJSON ¶
func (r AppDeploymentNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppDeploymentNewResponse) UnmarshalJSON ¶
func (r *AppDeploymentNewResponse) UnmarshalJSON(data []byte) error
type AppDeploymentNewResponseApp ¶
type AppDeploymentNewResponseApp struct { // ID for the app version deployed ID string `json:"id,required"` // List of actions available on the app Actions []AppDeploymentNewResponseAppAction `json:"actions,required"` // Name of the app Name string `json:"name,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field Actions respjson.Field Name respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (AppDeploymentNewResponseApp) RawJSON ¶
func (r AppDeploymentNewResponseApp) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppDeploymentNewResponseApp) UnmarshalJSON ¶
func (r *AppDeploymentNewResponseApp) UnmarshalJSON(data []byte) error
type AppDeploymentNewResponseAppAction ¶
type AppDeploymentNewResponseAppAction struct { // Name of the action Name string `json:"name,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Name respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (AppDeploymentNewResponseAppAction) RawJSON ¶
func (r AppDeploymentNewResponseAppAction) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppDeploymentNewResponseAppAction) UnmarshalJSON ¶
func (r *AppDeploymentNewResponseAppAction) UnmarshalJSON(data []byte) error
type AppDeploymentNewResponseStatus ¶
type AppDeploymentNewResponseStatus string
Current status of the deployment
const ( AppDeploymentNewResponseStatusQueued AppDeploymentNewResponseStatus = "queued" AppDeploymentNewResponseStatusDeploying AppDeploymentNewResponseStatus = "deploying" AppDeploymentNewResponseStatusSucceeded AppDeploymentNewResponseStatus = "succeeded" AppDeploymentNewResponseStatusFailed AppDeploymentNewResponseStatus = "failed" )
type AppDeploymentService ¶
type AppDeploymentService struct {
Options []option.RequestOption
}
AppDeploymentService contains methods and other services that help with interacting with the kernel 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 NewAppDeploymentService method instead.
func NewAppDeploymentService ¶
func NewAppDeploymentService(opts ...option.RequestOption) (r AppDeploymentService)
NewAppDeploymentService 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 (*AppDeploymentService) FollowStreaming ¶
func (r *AppDeploymentService) FollowStreaming(ctx context.Context, id string, opts ...option.RequestOption) (stream *ssestream.Stream[[]AppDeploymentFollowResponseUnion])
Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and status updates for a deployed application. The stream terminates automatically once the application reaches a terminal state.
func (*AppDeploymentService) New ¶
func (r *AppDeploymentService) New(ctx context.Context, body AppDeploymentNewParams, opts ...option.RequestOption) (res *AppDeploymentNewResponse, err error)
Deploy a new application
type AppInvocationGetResponse ¶
type AppInvocationGetResponse struct { // ID of the invocation ID string `json:"id,required"` // Name of the action invoked ActionName string `json:"action_name,required"` // Name of the application AppName string `json:"app_name,required"` // RFC 3339 Nanoseconds timestamp when the invocation started StartedAt time.Time `json:"started_at,required" format:"date-time"` // Status of the invocation // // Any of "queued", "running", "succeeded", "failed". Status AppInvocationGetResponseStatus `json:"status,required"` // RFC 3339 Nanoseconds timestamp when the invocation finished (null if still // running) FinishedAt time.Time `json:"finished_at,nullable" format:"date-time"` // Output produced by the action, rendered as a JSON string. This could be: string, // number, boolean, array, object, or null. Output string `json:"output"` // Payload provided to the invocation. This is a string that can be parsed as JSON. Payload string `json:"payload"` // Status reason StatusReason string `json:"status_reason"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field ActionName respjson.Field AppName respjson.Field StartedAt respjson.Field Status respjson.Field FinishedAt respjson.Field Output respjson.Field Payload respjson.Field StatusReason respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (AppInvocationGetResponse) RawJSON ¶
func (r AppInvocationGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppInvocationGetResponse) UnmarshalJSON ¶
func (r *AppInvocationGetResponse) UnmarshalJSON(data []byte) error
type AppInvocationGetResponseStatus ¶
type AppInvocationGetResponseStatus string
Status of the invocation
const ( AppInvocationGetResponseStatusQueued AppInvocationGetResponseStatus = "queued" AppInvocationGetResponseStatusRunning AppInvocationGetResponseStatus = "running" AppInvocationGetResponseStatusSucceeded AppInvocationGetResponseStatus = "succeeded" AppInvocationGetResponseStatusFailed AppInvocationGetResponseStatus = "failed" )
type AppInvocationNewParams ¶
type AppInvocationNewParams struct { // Name of the action to invoke ActionName string `json:"action_name,required"` // Name of the application AppName string `json:"app_name,required"` // Version of the application Version string `json:"version,required"` // Input data for the action, sent as a JSON string. Payload param.Opt[string] `json:"payload,omitzero"` // contains filtered or unexported fields }
func (AppInvocationNewParams) MarshalJSON ¶
func (r AppInvocationNewParams) MarshalJSON() (data []byte, err error)
func (*AppInvocationNewParams) UnmarshalJSON ¶
func (r *AppInvocationNewParams) UnmarshalJSON(data []byte) error
type AppInvocationNewResponse ¶
type AppInvocationNewResponse struct { // ID of the invocation ID string `json:"id,required"` // Status of the invocation // // Any of "queued", "running", "succeeded", "failed". Status AppInvocationNewResponseStatus `json:"status,required"` // The return value of the action that was invoked, rendered as a JSON string. This // could be: string, number, boolean, array, object, or null. Output string `json:"output"` // Status reason StatusReason string `json:"status_reason"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field Status respjson.Field Output respjson.Field StatusReason respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (AppInvocationNewResponse) RawJSON ¶
func (r AppInvocationNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppInvocationNewResponse) UnmarshalJSON ¶
func (r *AppInvocationNewResponse) UnmarshalJSON(data []byte) error
type AppInvocationNewResponseStatus ¶
type AppInvocationNewResponseStatus string
Status of the invocation
const ( AppInvocationNewResponseStatusQueued AppInvocationNewResponseStatus = "queued" AppInvocationNewResponseStatusRunning AppInvocationNewResponseStatus = "running" AppInvocationNewResponseStatusSucceeded AppInvocationNewResponseStatus = "succeeded" AppInvocationNewResponseStatusFailed AppInvocationNewResponseStatus = "failed" )
type AppInvocationService ¶
type AppInvocationService struct {
Options []option.RequestOption
}
AppInvocationService contains methods and other services that help with interacting with the kernel 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 NewAppInvocationService method instead.
func NewAppInvocationService ¶
func NewAppInvocationService(opts ...option.RequestOption) (r AppInvocationService)
NewAppInvocationService 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 (*AppInvocationService) Get ¶
func (r *AppInvocationService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *AppInvocationGetResponse, err error)
Get an app invocation by id
func (*AppInvocationService) New ¶
func (r *AppInvocationService) New(ctx context.Context, body AppInvocationNewParams, opts ...option.RequestOption) (res *AppInvocationNewResponse, err error)
Invoke an application
type AppListParams ¶
type AppListParams struct { // Filter results by application name. AppName param.Opt[string] `query:"app_name,omitzero" json:"-"` // Filter results by version label. Version param.Opt[string] `query:"version,omitzero" json:"-"` // contains filtered or unexported fields }
func (AppListParams) URLQuery ¶
func (r AppListParams) URLQuery() (v url.Values, err error)
URLQuery serializes AppListParams's query parameters as `url.Values`.
type AppListResponse ¶
type AppListResponse struct { // Unique identifier for the app version ID string `json:"id,required"` // Name of the application AppName string `json:"app_name,required"` // Deployment region code Region string `json:"region,required"` // Version label for the application Version string `json:"version,required"` // Environment variables configured for this app version EnvVars map[string]string `json:"env_vars"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field AppName respjson.Field Region respjson.Field Version respjson.Field EnvVars respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
Summary of an application version.
func (AppListResponse) RawJSON ¶
func (r AppListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppListResponse) UnmarshalJSON ¶
func (r *AppListResponse) UnmarshalJSON(data []byte) error
type AppService ¶
type AppService struct { Options []option.RequestOption Deployments AppDeploymentService Invocations AppInvocationService }
AppService contains methods and other services that help with interacting with the kernel 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 NewAppService method instead.
func NewAppService ¶
func NewAppService(opts ...option.RequestOption) (r AppService)
NewAppService 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 (*AppService) List ¶
func (r *AppService) List(ctx context.Context, query AppListParams, opts ...option.RequestOption) (res *[]AppListResponse, err error)
List application versions for the authenticated user. Optionally filter by app name and/or version label.
type BrowserGetResponse ¶
type BrowserGetResponse struct { // Remote URL for live viewing the browser session BrowserLiveViewURL string `json:"browser_live_view_url,required"` // Websocket URL for Chrome DevTools Protocol connections to the browser session CdpWsURL string `json:"cdp_ws_url,required"` // Unique identifier for the browser session SessionID string `json:"session_id,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { BrowserLiveViewURL respjson.Field CdpWsURL respjson.Field SessionID respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (BrowserGetResponse) RawJSON ¶
func (r BrowserGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrowserGetResponse) UnmarshalJSON ¶
func (r *BrowserGetResponse) UnmarshalJSON(data []byte) error
type BrowserNewParams ¶
type BrowserNewParams struct { // action invocation ID InvocationID string `json:"invocation_id,required"` // contains filtered or unexported fields }
func (BrowserNewParams) MarshalJSON ¶
func (r BrowserNewParams) MarshalJSON() (data []byte, err error)
func (*BrowserNewParams) UnmarshalJSON ¶
func (r *BrowserNewParams) UnmarshalJSON(data []byte) error
type BrowserNewResponse ¶
type BrowserNewResponse struct { // Remote URL for live viewing the browser session BrowserLiveViewURL string `json:"browser_live_view_url,required"` // Websocket URL for Chrome DevTools Protocol connections to the browser session CdpWsURL string `json:"cdp_ws_url,required"` // Unique identifier for the browser session SessionID string `json:"session_id,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { BrowserLiveViewURL respjson.Field CdpWsURL respjson.Field SessionID respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (BrowserNewResponse) RawJSON ¶
func (r BrowserNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrowserNewResponse) UnmarshalJSON ¶
func (r *BrowserNewResponse) UnmarshalJSON(data []byte) error
type BrowserService ¶
type BrowserService struct {
Options []option.RequestOption
}
BrowserService contains methods and other services that help with interacting with the kernel 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 NewBrowserService method instead.
func NewBrowserService ¶
func NewBrowserService(opts ...option.RequestOption) (r BrowserService)
NewBrowserService 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 (*BrowserService) Get ¶
func (r *BrowserService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *BrowserGetResponse, err error)
Get Browser Session by ID
func (*BrowserService) New ¶
func (r *BrowserService) New(ctx context.Context, body BrowserNewParams, opts ...option.RequestOption) (res *BrowserNewResponse, err error)
Create Browser Session
type Client ¶
type Client struct { Options []option.RequestOption Apps AppService Browsers BrowserService }
Client creates a struct with services and top level methods that help with interacting with the kernel 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 (KERNEL_API_KEY, KERNEL_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.
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.21, 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.21, and used by the Go 1.24 encoding/json package. |
packages
|
|
shared
|
|