kernel

package module
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

README

Kernel Go API Library

Go Reference

The Kernel Go library provides convenient access to the Kernel REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/onkernel/kernel-go-sdk" // imported as kernel
)

Or to pin the version:

go get -u 'github.com/onkernel/kernel-go-sdk@v0.14.0'

Requirements

This library requires Go 1.22+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/onkernel/kernel-go-sdk"
	"github.com/onkernel/kernel-go-sdk/option"
)

func main() {
	client := kernel.NewClient(
		option.WithAPIKey("My API Key"),     // defaults to os.LookupEnv("KERNEL_API_KEY")
		option.WithEnvironmentDevelopment(), // defaults to option.WithEnvironmentProduction()
	)
	browser, err := client.Browsers.New(context.TODO(), kernel.BrowserNewParams{
		Persistence: kernel.BrowserPersistenceParam{
			ID: "browser-for-user-1234",
		},
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", browser.SessionID)
}

Request fields

The kernel library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `json:"...,required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, kernel.String(string), kernel.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := kernel.ExampleParams{
	ID:   "id_xxx",             // required property
	Name: kernel.String("..."), // optional property

	Point: kernel.Point{
		X: 0,             // required field will serialize as 0
		Y: kernel.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: kernel.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[kernel.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of it's variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := kernel.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Browsers.New(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

iter := client.Deployments.ListAutoPaging(context.TODO(), kernel.DeploymentListParams{
	AppName: kernel.String("YOUR_APP"),
	Limit:   kernel.Int(2),
})
// Automatically fetches more pages as needed.
for iter.Next() {
	deploymentListResponse := iter.Current()
	fmt.Printf("%+v\n", deploymentListResponse)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

page, err := client.Deployments.List(context.TODO(), kernel.DeploymentListParams{
	AppName: kernel.String("YOUR_APP"),
	Limit:   kernel.Int(2),
})
for page != nil {
	for _, deployment := range page.Items {
		fmt.Printf("%+v\n", deployment)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *kernel.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Browsers.New(context.TODO(), kernel.BrowserNewParams{
	Persistence: kernel.BrowserPersistenceParam{
		ID: "browser-for-user-1234",
	},
})
if err != nil {
	var apierr *kernel.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/browsers": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Browsers.New(
	ctx,
	kernel.BrowserNewParams{
		Persistence: kernel.BrowserPersistenceParam{
			ID: "browser-for-user-1234",
		},
	},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper kernel.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

// A file from the file system
file, err := os.Open("/path/to/file")
kernel.DeploymentNewParams{
	EntrypointRelPath: "src/app.py",
	File:              file,
}

// A file from a string
kernel.DeploymentNewParams{
	EntrypointRelPath: "src/app.py",
	File:              strings.NewReader("my file contents"),
}

// With a custom filename and contentType
kernel.DeploymentNewParams{
	EntrypointRelPath: "src/app.py",
	File:              kernel.File(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
}
Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := kernel.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Browsers.New(
	context.TODO(),
	kernel.BrowserNewParams{
		Persistence: kernel.BrowserPersistenceParam{
			ID: "browser-for-user-1234",
		},
	},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
browser, err := client.Browsers.New(
	context.TODO(),
	kernel.BrowserNewParams{
		Persistence: kernel.BrowserPersistenceParam{
			ID: "browser-for-user-1234",
		},
	},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", browser)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: kernel.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := kernel.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

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 File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type AppAction added in v0.6.4

type AppAction = shared.AppAction

An action available on the app

This is an alias to an internal type.

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"`
	// List of actions available on the app
	Actions []shared.AppAction `json:"actions,required"`
	// Name of the application
	AppName string `json:"app_name,required"`
	// Deployment ID
	Deployment string `json:"deployment,required"`
	// Environment variables configured for this app version
	EnvVars map[string]string `json:"env_vars,required"`
	// Deployment region code
	Region constant.AwsUsEast1a `json:"region,required"`
	// Version label for the application
	Version string `json:"version,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Actions     respjson.Field
		AppName     respjson.Field
		Deployment  respjson.Field
		EnvVars     respjson.Field
		Region      respjson.Field
		Version     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
}

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 applications. Optionally filter by app name and/or version label.

type BrowserDeleteParams added in v0.3.0

type BrowserDeleteParams struct {
	// Persistent browser identifier
	PersistentID string `query:"persistent_id,required" json:"-"`
	// contains filtered or unexported fields
}

func (BrowserDeleteParams) URLQuery added in v0.3.0

func (r BrowserDeleteParams) URLQuery() (v url.Values, err error)

URLQuery serializes BrowserDeleteParams's query parameters as `url.Values`.

type BrowserFDeleteDirectoryParams added in v0.9.1

type BrowserFDeleteDirectoryParams struct {
	// Absolute path to delete.
	Path string `json:"path,required"`
	// contains filtered or unexported fields
}

func (BrowserFDeleteDirectoryParams) MarshalJSON added in v0.9.1

func (r BrowserFDeleteDirectoryParams) MarshalJSON() (data []byte, err error)

func (*BrowserFDeleteDirectoryParams) UnmarshalJSON added in v0.9.1

func (r *BrowserFDeleteDirectoryParams) UnmarshalJSON(data []byte) error

type BrowserFDeleteFileParams added in v0.9.1

type BrowserFDeleteFileParams struct {
	// Absolute path to delete.
	Path string `json:"path,required"`
	// contains filtered or unexported fields
}

func (BrowserFDeleteFileParams) MarshalJSON added in v0.9.1

func (r BrowserFDeleteFileParams) MarshalJSON() (data []byte, err error)

func (*BrowserFDeleteFileParams) UnmarshalJSON added in v0.9.1

func (r *BrowserFDeleteFileParams) UnmarshalJSON(data []byte) error

type BrowserFDownloadDirZipParams added in v0.10.0

type BrowserFDownloadDirZipParams struct {
	// Absolute directory path to archive and download.
	Path string `query:"path,required" json:"-"`
	// contains filtered or unexported fields
}

func (BrowserFDownloadDirZipParams) URLQuery added in v0.10.0

func (r BrowserFDownloadDirZipParams) URLQuery() (v url.Values, err error)

URLQuery serializes BrowserFDownloadDirZipParams's query parameters as `url.Values`.

type BrowserFFileInfoParams added in v0.9.1

type BrowserFFileInfoParams struct {
	// Absolute path of the file or directory.
	Path string `query:"path,required" json:"-"`
	// contains filtered or unexported fields
}

func (BrowserFFileInfoParams) URLQuery added in v0.9.1

func (r BrowserFFileInfoParams) URLQuery() (v url.Values, err error)

URLQuery serializes BrowserFFileInfoParams's query parameters as `url.Values`.

type BrowserFFileInfoResponse added in v0.9.1

type BrowserFFileInfoResponse struct {
	// Whether the path is a directory.
	IsDir bool `json:"is_dir,required"`
	// Last modification time.
	ModTime time.Time `json:"mod_time,required" format:"date-time"`
	// File mode bits (e.g., "drwxr-xr-x" or "-rw-r--r--").
	Mode string `json:"mode,required"`
	// Base name of the file or directory.
	Name string `json:"name,required"`
	// Absolute path.
	Path string `json:"path,required"`
	// Size in bytes. 0 for directories.
	SizeBytes int64 `json:"size_bytes,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		IsDir       respjson.Field
		ModTime     respjson.Field
		Mode        respjson.Field
		Name        respjson.Field
		Path        respjson.Field
		SizeBytes   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BrowserFFileInfoResponse) RawJSON added in v0.9.1

func (r BrowserFFileInfoResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BrowserFFileInfoResponse) UnmarshalJSON added in v0.9.1

func (r *BrowserFFileInfoResponse) UnmarshalJSON(data []byte) error

type BrowserFListFilesParams added in v0.9.1

type BrowserFListFilesParams struct {
	// Absolute directory path.
	Path string `query:"path,required" json:"-"`
	// contains filtered or unexported fields
}

func (BrowserFListFilesParams) URLQuery added in v0.9.1

func (r BrowserFListFilesParams) URLQuery() (v url.Values, err error)

URLQuery serializes BrowserFListFilesParams's query parameters as `url.Values`.

type BrowserFListFilesResponse added in v0.9.1

type BrowserFListFilesResponse struct {
	// Whether the path is a directory.
	IsDir bool `json:"is_dir,required"`
	// Last modification time.
	ModTime time.Time `json:"mod_time,required" format:"date-time"`
	// File mode bits (e.g., "drwxr-xr-x" or "-rw-r--r--").
	Mode string `json:"mode,required"`
	// Base name of the file or directory.
	Name string `json:"name,required"`
	// Absolute path.
	Path string `json:"path,required"`
	// Size in bytes. 0 for directories.
	SizeBytes int64 `json:"size_bytes,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		IsDir       respjson.Field
		ModTime     respjson.Field
		Mode        respjson.Field
		Name        respjson.Field
		Path        respjson.Field
		SizeBytes   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BrowserFListFilesResponse) RawJSON added in v0.9.1

func (r BrowserFListFilesResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BrowserFListFilesResponse) UnmarshalJSON added in v0.9.1

func (r *BrowserFListFilesResponse) UnmarshalJSON(data []byte) error

type BrowserFMoveParams added in v0.9.1

type BrowserFMoveParams struct {
	// Absolute destination path.
	DestPath string `json:"dest_path,required"`
	// Absolute source path.
	SrcPath string `json:"src_path,required"`
	// contains filtered or unexported fields
}

func (BrowserFMoveParams) MarshalJSON added in v0.9.1

func (r BrowserFMoveParams) MarshalJSON() (data []byte, err error)

func (*BrowserFMoveParams) UnmarshalJSON added in v0.9.1

func (r *BrowserFMoveParams) UnmarshalJSON(data []byte) error

type BrowserFNewDirectoryParams added in v0.9.1

type BrowserFNewDirectoryParams struct {
	// Absolute directory path to create.
	Path string `json:"path,required"`
	// Optional directory mode (octal string, e.g. 755). Defaults to 755.
	Mode param.Opt[string] `json:"mode,omitzero"`
	// contains filtered or unexported fields
}

func (BrowserFNewDirectoryParams) MarshalJSON added in v0.9.1

func (r BrowserFNewDirectoryParams) MarshalJSON() (data []byte, err error)

func (*BrowserFNewDirectoryParams) UnmarshalJSON added in v0.9.1

func (r *BrowserFNewDirectoryParams) UnmarshalJSON(data []byte) error

type BrowserFReadFileParams added in v0.9.1

type BrowserFReadFileParams struct {
	// Absolute file path to read.
	Path string `query:"path,required" json:"-"`
	// contains filtered or unexported fields
}

func (BrowserFReadFileParams) URLQuery added in v0.9.1

func (r BrowserFReadFileParams) URLQuery() (v url.Values, err error)

URLQuery serializes BrowserFReadFileParams's query parameters as `url.Values`.

type BrowserFService added in v0.9.1

type BrowserFService struct {
	Options []option.RequestOption
	Watch   BrowserFWatchService
}

BrowserFService 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 NewBrowserFService method instead.

func NewBrowserFService added in v0.9.1

func NewBrowserFService(opts ...option.RequestOption) (r BrowserFService)

NewBrowserFService 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 (*BrowserFService) DeleteDirectory added in v0.9.1

func (r *BrowserFService) DeleteDirectory(ctx context.Context, id string, body BrowserFDeleteDirectoryParams, opts ...option.RequestOption) (err error)

Delete a directory

func (*BrowserFService) DeleteFile added in v0.9.1

func (r *BrowserFService) DeleteFile(ctx context.Context, id string, body BrowserFDeleteFileParams, opts ...option.RequestOption) (err error)

Delete a file

func (*BrowserFService) DownloadDirZip added in v0.10.0

func (r *BrowserFService) DownloadDirZip(ctx context.Context, id string, query BrowserFDownloadDirZipParams, opts ...option.RequestOption) (res *http.Response, err error)

Returns a ZIP file containing the contents of the specified directory.

func (*BrowserFService) FileInfo added in v0.9.1

Get information about a file or directory

func (*BrowserFService) ListFiles added in v0.9.1

List files in a directory

func (*BrowserFService) Move added in v0.9.1

func (r *BrowserFService) Move(ctx context.Context, id string, body BrowserFMoveParams, opts ...option.RequestOption) (err error)

Move or rename a file or directory

func (*BrowserFService) NewDirectory added in v0.9.1

func (r *BrowserFService) NewDirectory(ctx context.Context, id string, body BrowserFNewDirectoryParams, opts ...option.RequestOption) (err error)

Create a new directory

func (*BrowserFService) ReadFile added in v0.9.1

func (r *BrowserFService) ReadFile(ctx context.Context, id string, query BrowserFReadFileParams, opts ...option.RequestOption) (res *http.Response, err error)

Read file contents

func (*BrowserFService) SetFilePermissions added in v0.9.1

func (r *BrowserFService) SetFilePermissions(ctx context.Context, id string, body BrowserFSetFilePermissionsParams, opts ...option.RequestOption) (err error)

Set file or directory permissions/ownership

func (*BrowserFService) Upload added in v0.10.0

func (r *BrowserFService) Upload(ctx context.Context, id string, body BrowserFUploadParams, opts ...option.RequestOption) (err error)

Allows uploading single or multiple files to the remote filesystem.

func (*BrowserFService) UploadZip added in v0.10.0

func (r *BrowserFService) UploadZip(ctx context.Context, id string, body BrowserFUploadZipParams, opts ...option.RequestOption) (err error)

Upload a zip file and extract its contents to the specified destination path.

func (*BrowserFService) WriteFile added in v0.9.1

func (r *BrowserFService) WriteFile(ctx context.Context, id string, contents io.Reader, body BrowserFWriteFileParams, opts ...option.RequestOption) (err error)

Write or create a file

type BrowserFSetFilePermissionsParams added in v0.9.1

type BrowserFSetFilePermissionsParams struct {
	// File mode bits (octal string, e.g. 644).
	Mode string `json:"mode,required"`
	// Absolute path whose permissions are to be changed.
	Path string `json:"path,required"`
	// New group name or GID.
	Group param.Opt[string] `json:"group,omitzero"`
	// New owner username or UID.
	Owner param.Opt[string] `json:"owner,omitzero"`
	// contains filtered or unexported fields
}

func (BrowserFSetFilePermissionsParams) MarshalJSON added in v0.9.1

func (r BrowserFSetFilePermissionsParams) MarshalJSON() (data []byte, err error)

func (*BrowserFSetFilePermissionsParams) UnmarshalJSON added in v0.9.1

func (r *BrowserFSetFilePermissionsParams) UnmarshalJSON(data []byte) error

type BrowserFUploadParams added in v0.10.0

type BrowserFUploadParams struct {
	Files []BrowserFUploadParamsFile `json:"files,omitzero,required"`
	// contains filtered or unexported fields
}

func (BrowserFUploadParams) MarshalMultipart added in v0.10.0

func (r BrowserFUploadParams) MarshalMultipart() (data []byte, contentType string, err error)

type BrowserFUploadParamsFile added in v0.10.0

type BrowserFUploadParamsFile struct {
	// Absolute destination path to write the file.
	DestPath string    `json:"dest_path,required"`
	File     io.Reader `json:"file,omitzero,required" format:"binary"`
	// contains filtered or unexported fields
}

The properties DestPath, File are required.

func (BrowserFUploadParamsFile) MarshalJSON added in v0.10.0

func (r BrowserFUploadParamsFile) MarshalJSON() (data []byte, err error)

func (*BrowserFUploadParamsFile) UnmarshalJSON added in v0.10.0

func (r *BrowserFUploadParamsFile) UnmarshalJSON(data []byte) error

type BrowserFUploadZipParams added in v0.10.0

type BrowserFUploadZipParams struct {
	// Absolute destination directory to extract the archive to.
	DestPath string    `json:"dest_path,required"`
	ZipFile  io.Reader `json:"zip_file,omitzero,required" format:"binary"`
	// contains filtered or unexported fields
}

func (BrowserFUploadZipParams) MarshalMultipart added in v0.10.0

func (r BrowserFUploadZipParams) MarshalMultipart() (data []byte, contentType string, err error)

type BrowserFWatchEventsParams added in v0.9.1

type BrowserFWatchEventsParams struct {
	ID string `path:"id,required" json:"-"`
	// contains filtered or unexported fields
}

type BrowserFWatchEventsResponse added in v0.9.1

type BrowserFWatchEventsResponse struct {
	// Absolute path of the file or directory.
	Path string `json:"path,required"`
	// Event type.
	//
	// Any of "CREATE", "WRITE", "DELETE", "RENAME".
	Type BrowserFWatchEventsResponseType `json:"type,required"`
	// Whether the affected path is a directory.
	IsDir bool `json:"is_dir"`
	// Base name of the file or directory affected.
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Path        respjson.Field
		Type        respjson.Field
		IsDir       respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Filesystem change event.

func (BrowserFWatchEventsResponse) RawJSON added in v0.9.1

func (r BrowserFWatchEventsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BrowserFWatchEventsResponse) UnmarshalJSON added in v0.9.1

func (r *BrowserFWatchEventsResponse) UnmarshalJSON(data []byte) error

type BrowserFWatchEventsResponseType added in v0.9.1

type BrowserFWatchEventsResponseType string

Event type.

const (
	BrowserFWatchEventsResponseTypeCreate BrowserFWatchEventsResponseType = "CREATE"
	BrowserFWatchEventsResponseTypeWrite  BrowserFWatchEventsResponseType = "WRITE"
	BrowserFWatchEventsResponseTypeDelete BrowserFWatchEventsResponseType = "DELETE"
	BrowserFWatchEventsResponseTypeRename BrowserFWatchEventsResponseType = "RENAME"
)

type BrowserFWatchService added in v0.9.1

type BrowserFWatchService struct {
	Options []option.RequestOption
}

BrowserFWatchService 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 NewBrowserFWatchService method instead.

func NewBrowserFWatchService added in v0.9.1

func NewBrowserFWatchService(opts ...option.RequestOption) (r BrowserFWatchService)

NewBrowserFWatchService 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 (*BrowserFWatchService) EventsStreaming added in v0.9.1

Stream filesystem events for a watch

func (*BrowserFWatchService) Start added in v0.9.1

Watch a directory for changes

func (*BrowserFWatchService) Stop added in v0.9.1

func (r *BrowserFWatchService) Stop(ctx context.Context, watchID string, body BrowserFWatchStopParams, opts ...option.RequestOption) (err error)

Stop watching a directory

type BrowserFWatchStartParams added in v0.9.1

type BrowserFWatchStartParams struct {
	// Directory to watch.
	Path string `json:"path,required"`
	// Whether to watch recursively.
	Recursive param.Opt[bool] `json:"recursive,omitzero"`
	// contains filtered or unexported fields
}

func (BrowserFWatchStartParams) MarshalJSON added in v0.9.1

func (r BrowserFWatchStartParams) MarshalJSON() (data []byte, err error)

func (*BrowserFWatchStartParams) UnmarshalJSON added in v0.9.1

func (r *BrowserFWatchStartParams) UnmarshalJSON(data []byte) error

type BrowserFWatchStartResponse added in v0.9.1

type BrowserFWatchStartResponse struct {
	// Unique identifier for the directory watch
	WatchID string `json:"watch_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		WatchID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BrowserFWatchStartResponse) RawJSON added in v0.9.1

func (r BrowserFWatchStartResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BrowserFWatchStartResponse) UnmarshalJSON added in v0.9.1

func (r *BrowserFWatchStartResponse) UnmarshalJSON(data []byte) error

type BrowserFWatchStopParams added in v0.9.1

type BrowserFWatchStopParams struct {
	ID string `path:"id,required" json:"-"`
	// contains filtered or unexported fields
}

type BrowserFWriteFileParams added in v0.9.1

type BrowserFWriteFileParams struct {
	// Destination absolute file path.
	Path string `query:"path,required" json:"-"`
	// Optional file mode (octal string, e.g. 644). Defaults to 644.
	Mode param.Opt[string] `query:"mode,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (BrowserFWriteFileParams) MarshalMultipart added in v0.9.1

func (r BrowserFWriteFileParams) MarshalMultipart() (data []byte, contentType string, err error)

func (BrowserFWriteFileParams) URLQuery added in v0.9.1

func (r BrowserFWriteFileParams) URLQuery() (v url.Values, err error)

URLQuery serializes BrowserFWriteFileParams's query parameters as `url.Values`.

type BrowserGetResponse

type BrowserGetResponse struct {
	// Websocket URL for Chrome DevTools Protocol connections to the browser session
	CdpWsURL string `json:"cdp_ws_url,required"`
	// When the browser session was created.
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Whether the browser session is running in headless mode.
	Headless bool `json:"headless,required"`
	// Unique identifier for the browser session
	SessionID string `json:"session_id,required"`
	// Whether the browser session is running in stealth mode.
	Stealth bool `json:"stealth,required"`
	// The number of seconds of inactivity before the browser session is terminated.
	TimeoutSeconds int64 `json:"timeout_seconds,required"`
	// Remote URL for live viewing the browser session. Only available for non-headless
	// browsers.
	BrowserLiveViewURL string `json:"browser_live_view_url"`
	// Optional persistence configuration for the browser session.
	Persistence BrowserPersistence `json:"persistence"`
	// Browser profile metadata.
	Profile Profile `json:"profile"`
	// ID of the proxy associated with this browser session, if any.
	ProxyID string `json:"proxy_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CdpWsURL           respjson.Field
		CreatedAt          respjson.Field
		Headless           respjson.Field
		SessionID          respjson.Field
		Stealth            respjson.Field
		TimeoutSeconds     respjson.Field
		BrowserLiveViewURL respjson.Field
		Persistence        respjson.Field
		Profile            respjson.Field
		ProxyID            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 BrowserListResponse added in v0.3.0

type BrowserListResponse struct {
	// Websocket URL for Chrome DevTools Protocol connections to the browser session
	CdpWsURL string `json:"cdp_ws_url,required"`
	// When the browser session was created.
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Whether the browser session is running in headless mode.
	Headless bool `json:"headless,required"`
	// Unique identifier for the browser session
	SessionID string `json:"session_id,required"`
	// Whether the browser session is running in stealth mode.
	Stealth bool `json:"stealth,required"`
	// The number of seconds of inactivity before the browser session is terminated.
	TimeoutSeconds int64 `json:"timeout_seconds,required"`
	// Remote URL for live viewing the browser session. Only available for non-headless
	// browsers.
	BrowserLiveViewURL string `json:"browser_live_view_url"`
	// Optional persistence configuration for the browser session.
	Persistence BrowserPersistence `json:"persistence"`
	// Browser profile metadata.
	Profile Profile `json:"profile"`
	// ID of the proxy associated with this browser session, if any.
	ProxyID string `json:"proxy_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CdpWsURL           respjson.Field
		CreatedAt          respjson.Field
		Headless           respjson.Field
		SessionID          respjson.Field
		Stealth            respjson.Field
		TimeoutSeconds     respjson.Field
		BrowserLiveViewURL respjson.Field
		Persistence        respjson.Field
		Profile            respjson.Field
		ProxyID            respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BrowserListResponse) RawJSON added in v0.3.0

func (r BrowserListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BrowserListResponse) UnmarshalJSON added in v0.3.0

func (r *BrowserListResponse) UnmarshalJSON(data []byte) error

type BrowserLogService added in v0.10.0

type BrowserLogService struct {
	Options []option.RequestOption
}

BrowserLogService 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 NewBrowserLogService method instead.

func NewBrowserLogService added in v0.10.0

func NewBrowserLogService(opts ...option.RequestOption) (r BrowserLogService)

NewBrowserLogService 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 (*BrowserLogService) StreamStreaming added in v0.10.0

func (r *BrowserLogService) StreamStreaming(ctx context.Context, id string, query BrowserLogStreamParams, opts ...option.RequestOption) (stream *ssestream.Stream[shared.LogEvent])

Stream log files on the browser instance via SSE

type BrowserLogStreamParams added in v0.10.0

type BrowserLogStreamParams struct {
	// Any of "path", "supervisor".
	Source BrowserLogStreamParamsSource `query:"source,omitzero,required" json:"-"`
	Follow param.Opt[bool]              `query:"follow,omitzero" json:"-"`
	// only required if source is path
	Path param.Opt[string] `query:"path,omitzero" json:"-"`
	// only required if source is supervisor
	SupervisorProcess param.Opt[string] `query:"supervisor_process,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (BrowserLogStreamParams) URLQuery added in v0.10.0

func (r BrowserLogStreamParams) URLQuery() (v url.Values, err error)

URLQuery serializes BrowserLogStreamParams's query parameters as `url.Values`.

type BrowserLogStreamParamsSource added in v0.10.0

type BrowserLogStreamParamsSource string
const (
	BrowserLogStreamParamsSourcePath       BrowserLogStreamParamsSource = "path"
	BrowserLogStreamParamsSourceSupervisor BrowserLogStreamParamsSource = "supervisor"
)

type BrowserNewParams

type BrowserNewParams struct {
	// If true, launches the browser using a headless image (no VNC/GUI). Defaults to
	// false.
	Headless param.Opt[bool] `json:"headless,omitzero"`
	// action invocation ID
	InvocationID param.Opt[string] `json:"invocation_id,omitzero"`
	// Optional proxy to associate to the browser session. Must reference a proxy
	// belonging to the caller's org.
	ProxyID param.Opt[string] `json:"proxy_id,omitzero"`
	// If true, launches the browser in stealth mode to reduce detection by anti-bot
	// mechanisms.
	Stealth param.Opt[bool] `json:"stealth,omitzero"`
	// The number of seconds of inactivity before the browser session is terminated.
	// Only applicable to non-persistent browsers. Activity includes CDP connections
	// and live view connections. Defaults to 60 seconds. Minimum allowed is 10
	// seconds. Maximum allowed is 86400 (24 hours). We check for inactivity every 5
	// seconds, so the actual timeout behavior you will see is +/- 5 seconds around the
	// specified value.
	TimeoutSeconds param.Opt[int64] `json:"timeout_seconds,omitzero"`
	// Optional persistence configuration for the browser session.
	Persistence BrowserPersistenceParam `json:"persistence,omitzero"`
	// Profile selection for the browser session. Provide either id or name. If
	// specified, the matching profile will be loaded into the browser session.
	// Profiles must be created beforehand.
	Profile BrowserNewParamsProfile `json:"profile,omitzero"`
	// 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 BrowserNewParamsProfile added in v0.11.2

type BrowserNewParamsProfile struct {
	// Profile ID to load for this browser session
	ID param.Opt[string] `json:"id,omitzero"`
	// Profile name to load for this browser session (instead of id). Must be 1-255
	// characters, using letters, numbers, dots, underscores, or hyphens.
	Name param.Opt[string] `json:"name,omitzero"`
	// If true, save changes made during the session back to the profile when the
	// session ends.
	SaveChanges param.Opt[bool] `json:"save_changes,omitzero"`
	// contains filtered or unexported fields
}

Profile selection for the browser session. Provide either id or name. If specified, the matching profile will be loaded into the browser session. Profiles must be created beforehand.

func (BrowserNewParamsProfile) MarshalJSON added in v0.11.2

func (r BrowserNewParamsProfile) MarshalJSON() (data []byte, err error)

func (*BrowserNewParamsProfile) UnmarshalJSON added in v0.11.2

func (r *BrowserNewParamsProfile) UnmarshalJSON(data []byte) error

type BrowserNewResponse

type BrowserNewResponse struct {
	// Websocket URL for Chrome DevTools Protocol connections to the browser session
	CdpWsURL string `json:"cdp_ws_url,required"`
	// When the browser session was created.
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Whether the browser session is running in headless mode.
	Headless bool `json:"headless,required"`
	// Unique identifier for the browser session
	SessionID string `json:"session_id,required"`
	// Whether the browser session is running in stealth mode.
	Stealth bool `json:"stealth,required"`
	// The number of seconds of inactivity before the browser session is terminated.
	TimeoutSeconds int64 `json:"timeout_seconds,required"`
	// Remote URL for live viewing the browser session. Only available for non-headless
	// browsers.
	BrowserLiveViewURL string `json:"browser_live_view_url"`
	// Optional persistence configuration for the browser session.
	Persistence BrowserPersistence `json:"persistence"`
	// Browser profile metadata.
	Profile Profile `json:"profile"`
	// ID of the proxy associated with this browser session, if any.
	ProxyID string `json:"proxy_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CdpWsURL           respjson.Field
		CreatedAt          respjson.Field
		Headless           respjson.Field
		SessionID          respjson.Field
		Stealth            respjson.Field
		TimeoutSeconds     respjson.Field
		BrowserLiveViewURL respjson.Field
		Persistence        respjson.Field
		Profile            respjson.Field
		ProxyID            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 BrowserPersistence added in v0.3.0

type BrowserPersistence struct {
	// Unique identifier for the persistent browser session.
	ID string `json:"id,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Optional persistence configuration for the browser session.

func (BrowserPersistence) RawJSON added in v0.3.0

func (r BrowserPersistence) RawJSON() string

Returns the unmodified JSON received from the API

func (BrowserPersistence) ToParam added in v0.3.0

ToParam converts this BrowserPersistence to a BrowserPersistenceParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BrowserPersistenceParam.Overrides()

func (*BrowserPersistence) UnmarshalJSON added in v0.3.0

func (r *BrowserPersistence) UnmarshalJSON(data []byte) error

type BrowserPersistenceParam added in v0.3.0

type BrowserPersistenceParam struct {
	// Unique identifier for the persistent browser session.
	ID string `json:"id,required"`
	// contains filtered or unexported fields
}

Optional persistence configuration for the browser session.

The property ID is required.

func (BrowserPersistenceParam) MarshalJSON added in v0.3.0

func (r BrowserPersistenceParam) MarshalJSON() (data []byte, err error)

func (*BrowserPersistenceParam) UnmarshalJSON added in v0.3.0

func (r *BrowserPersistenceParam) UnmarshalJSON(data []byte) error

type BrowserProcessExecParams added in v0.10.0

type BrowserProcessExecParams struct {
	// Executable or shell command to run.
	Command string `json:"command,required"`
	// Run the process as this user.
	AsUser param.Opt[string] `json:"as_user,omitzero"`
	// Working directory (absolute path) to run the command in.
	Cwd param.Opt[string] `json:"cwd,omitzero"`
	// Maximum execution time in seconds.
	TimeoutSec param.Opt[int64] `json:"timeout_sec,omitzero"`
	// Run the process with root privileges.
	AsRoot param.Opt[bool] `json:"as_root,omitzero"`
	// Command arguments.
	Args []string `json:"args,omitzero"`
	// Environment variables to set for the process.
	Env map[string]string `json:"env,omitzero"`
	// contains filtered or unexported fields
}

func (BrowserProcessExecParams) MarshalJSON added in v0.10.0

func (r BrowserProcessExecParams) MarshalJSON() (data []byte, err error)

func (*BrowserProcessExecParams) UnmarshalJSON added in v0.10.0

func (r *BrowserProcessExecParams) UnmarshalJSON(data []byte) error

type BrowserProcessExecResponse added in v0.10.0

type BrowserProcessExecResponse struct {
	// Execution duration in milliseconds.
	DurationMs int64 `json:"duration_ms"`
	// Process exit code.
	ExitCode int64 `json:"exit_code"`
	// Base64-encoded stderr buffer.
	StderrB64 string `json:"stderr_b64"`
	// Base64-encoded stdout buffer.
	StdoutB64 string `json:"stdout_b64"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationMs  respjson.Field
		ExitCode    respjson.Field
		StderrB64   respjson.Field
		StdoutB64   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Result of a synchronous command execution.

func (BrowserProcessExecResponse) RawJSON added in v0.10.0

func (r BrowserProcessExecResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BrowserProcessExecResponse) UnmarshalJSON added in v0.10.0

func (r *BrowserProcessExecResponse) UnmarshalJSON(data []byte) error

type BrowserProcessKillParams added in v0.10.0

type BrowserProcessKillParams struct {
	ID string `path:"id,required" json:"-"`
	// Signal to send.
	//
	// Any of "TERM", "KILL", "INT", "HUP".
	Signal BrowserProcessKillParamsSignal `json:"signal,omitzero,required"`
	// contains filtered or unexported fields
}

func (BrowserProcessKillParams) MarshalJSON added in v0.10.0

func (r BrowserProcessKillParams) MarshalJSON() (data []byte, err error)

func (*BrowserProcessKillParams) UnmarshalJSON added in v0.10.0

func (r *BrowserProcessKillParams) UnmarshalJSON(data []byte) error

type BrowserProcessKillParamsSignal added in v0.10.0

type BrowserProcessKillParamsSignal string

Signal to send.

const (
	BrowserProcessKillParamsSignalTerm BrowserProcessKillParamsSignal = "TERM"
	BrowserProcessKillParamsSignalKill BrowserProcessKillParamsSignal = "KILL"
	BrowserProcessKillParamsSignalInt  BrowserProcessKillParamsSignal = "INT"
	BrowserProcessKillParamsSignalHup  BrowserProcessKillParamsSignal = "HUP"
)

type BrowserProcessKillResponse added in v0.10.0

type BrowserProcessKillResponse struct {
	// Indicates success.
	Ok bool `json:"ok,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Ok          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Generic OK response.

func (BrowserProcessKillResponse) RawJSON added in v0.10.0

func (r BrowserProcessKillResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BrowserProcessKillResponse) UnmarshalJSON added in v0.10.0

func (r *BrowserProcessKillResponse) UnmarshalJSON(data []byte) error

type BrowserProcessService added in v0.10.0

type BrowserProcessService struct {
	Options []option.RequestOption
}

BrowserProcessService 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 NewBrowserProcessService method instead.

func NewBrowserProcessService added in v0.10.0

func NewBrowserProcessService(opts ...option.RequestOption) (r BrowserProcessService)

NewBrowserProcessService 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 (*BrowserProcessService) Exec added in v0.10.0

Execute a command synchronously

func (*BrowserProcessService) Kill added in v0.10.0

Send signal to process

func (*BrowserProcessService) Spawn added in v0.10.0

Execute a command asynchronously

func (*BrowserProcessService) Status added in v0.10.0

Get process status

func (*BrowserProcessService) Stdin added in v0.10.0

Write to process stdin

func (*BrowserProcessService) StdoutStreamStreaming added in v0.10.0

Stream process stdout via SSE

type BrowserProcessSpawnParams added in v0.10.0

type BrowserProcessSpawnParams struct {
	// Executable or shell command to run.
	Command string `json:"command,required"`
	// Run the process as this user.
	AsUser param.Opt[string] `json:"as_user,omitzero"`
	// Working directory (absolute path) to run the command in.
	Cwd param.Opt[string] `json:"cwd,omitzero"`
	// Maximum execution time in seconds.
	TimeoutSec param.Opt[int64] `json:"timeout_sec,omitzero"`
	// Run the process with root privileges.
	AsRoot param.Opt[bool] `json:"as_root,omitzero"`
	// Command arguments.
	Args []string `json:"args,omitzero"`
	// Environment variables to set for the process.
	Env map[string]string `json:"env,omitzero"`
	// contains filtered or unexported fields
}

func (BrowserProcessSpawnParams) MarshalJSON added in v0.10.0

func (r BrowserProcessSpawnParams) MarshalJSON() (data []byte, err error)

func (*BrowserProcessSpawnParams) UnmarshalJSON added in v0.10.0

func (r *BrowserProcessSpawnParams) UnmarshalJSON(data []byte) error

type BrowserProcessSpawnResponse added in v0.10.0

type BrowserProcessSpawnResponse struct {
	// OS process ID.
	Pid int64 `json:"pid"`
	// Server-assigned identifier for the process.
	ProcessID string `json:"process_id" format:"uuid"`
	// Timestamp when the process started.
	StartedAt time.Time `json:"started_at" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Pid         respjson.Field
		ProcessID   respjson.Field
		StartedAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about a spawned process.

func (BrowserProcessSpawnResponse) RawJSON added in v0.10.0

func (r BrowserProcessSpawnResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BrowserProcessSpawnResponse) UnmarshalJSON added in v0.10.0

func (r *BrowserProcessSpawnResponse) UnmarshalJSON(data []byte) error

type BrowserProcessStatusParams added in v0.10.0

type BrowserProcessStatusParams struct {
	ID string `path:"id,required" json:"-"`
	// contains filtered or unexported fields
}

type BrowserProcessStatusResponse added in v0.10.0

type BrowserProcessStatusResponse struct {
	// Estimated CPU usage percentage.
	CPUPct float64 `json:"cpu_pct"`
	// Exit code if the process has exited.
	ExitCode int64 `json:"exit_code,nullable"`
	// Estimated resident memory usage in bytes.
	MemBytes int64 `json:"mem_bytes"`
	// Process state.
	//
	// Any of "running", "exited".
	State BrowserProcessStatusResponseState `json:"state"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CPUPct      respjson.Field
		ExitCode    respjson.Field
		MemBytes    respjson.Field
		State       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Current status of a process.

func (BrowserProcessStatusResponse) RawJSON added in v0.10.0

Returns the unmodified JSON received from the API

func (*BrowserProcessStatusResponse) UnmarshalJSON added in v0.10.0

func (r *BrowserProcessStatusResponse) UnmarshalJSON(data []byte) error

type BrowserProcessStatusResponseState added in v0.10.0

type BrowserProcessStatusResponseState string

Process state.

const (
	BrowserProcessStatusResponseStateRunning BrowserProcessStatusResponseState = "running"
	BrowserProcessStatusResponseStateExited  BrowserProcessStatusResponseState = "exited"
)

type BrowserProcessStdinParams added in v0.10.0

type BrowserProcessStdinParams struct {
	ID string `path:"id,required" json:"-"`
	// Base64-encoded data to write.
	DataB64 string `json:"data_b64,required"`
	// contains filtered or unexported fields
}

func (BrowserProcessStdinParams) MarshalJSON added in v0.10.0

func (r BrowserProcessStdinParams) MarshalJSON() (data []byte, err error)

func (*BrowserProcessStdinParams) UnmarshalJSON added in v0.10.0

func (r *BrowserProcessStdinParams) UnmarshalJSON(data []byte) error

type BrowserProcessStdinResponse added in v0.10.0

type BrowserProcessStdinResponse struct {
	// Number of bytes written.
	WrittenBytes int64 `json:"written_bytes"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		WrittenBytes respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Result of writing to stdin.

func (BrowserProcessStdinResponse) RawJSON added in v0.10.0

func (r BrowserProcessStdinResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BrowserProcessStdinResponse) UnmarshalJSON added in v0.10.0

func (r *BrowserProcessStdinResponse) UnmarshalJSON(data []byte) error

type BrowserProcessStdoutStreamParams added in v0.10.0

type BrowserProcessStdoutStreamParams struct {
	ID string `path:"id,required" json:"-"`
	// contains filtered or unexported fields
}

type BrowserProcessStdoutStreamResponse added in v0.10.0

type BrowserProcessStdoutStreamResponse struct {
	// Base64-encoded data from the process stream.
	DataB64 string `json:"data_b64"`
	// Lifecycle event type.
	//
	// Any of "exit".
	Event BrowserProcessStdoutStreamResponseEvent `json:"event"`
	// Exit code when the event is "exit".
	ExitCode int64 `json:"exit_code"`
	// Source stream of the data chunk.
	//
	// Any of "stdout", "stderr".
	Stream BrowserProcessStdoutStreamResponseStream `json:"stream"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DataB64     respjson.Field
		Event       respjson.Field
		ExitCode    respjson.Field
		Stream      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

SSE payload representing process output or lifecycle events.

func (BrowserProcessStdoutStreamResponse) RawJSON added in v0.10.0

Returns the unmodified JSON received from the API

func (*BrowserProcessStdoutStreamResponse) UnmarshalJSON added in v0.10.0

func (r *BrowserProcessStdoutStreamResponse) UnmarshalJSON(data []byte) error

type BrowserProcessStdoutStreamResponseEvent added in v0.10.0

type BrowserProcessStdoutStreamResponseEvent string

Lifecycle event type.

const (
	BrowserProcessStdoutStreamResponseEventExit BrowserProcessStdoutStreamResponseEvent = "exit"
)

type BrowserProcessStdoutStreamResponseStream added in v0.10.0

type BrowserProcessStdoutStreamResponseStream string

Source stream of the data chunk.

const (
	BrowserProcessStdoutStreamResponseStreamStdout BrowserProcessStdoutStreamResponseStream = "stdout"
	BrowserProcessStdoutStreamResponseStreamStderr BrowserProcessStdoutStreamResponseStream = "stderr"
)

type BrowserReplayDownloadParams added in v0.8.0

type BrowserReplayDownloadParams struct {
	ID string `path:"id,required" json:"-"`
	// contains filtered or unexported fields
}

type BrowserReplayListResponse added in v0.8.0

type BrowserReplayListResponse struct {
	// Unique identifier for the replay recording.
	ReplayID string `json:"replay_id,required"`
	// Timestamp when replay finished
	FinishedAt time.Time `json:"finished_at,nullable" format:"date-time"`
	// URL for viewing the replay recording.
	ReplayViewURL string `json:"replay_view_url"`
	// Timestamp when replay started
	StartedAt time.Time `json:"started_at,nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ReplayID      respjson.Field
		FinishedAt    respjson.Field
		ReplayViewURL respjson.Field
		StartedAt     respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about a browser replay recording.

func (BrowserReplayListResponse) RawJSON added in v0.8.0

func (r BrowserReplayListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BrowserReplayListResponse) UnmarshalJSON added in v0.8.0

func (r *BrowserReplayListResponse) UnmarshalJSON(data []byte) error

type BrowserReplayService added in v0.8.0

type BrowserReplayService struct {
	Options []option.RequestOption
}

BrowserReplayService 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 NewBrowserReplayService method instead.

func NewBrowserReplayService added in v0.8.0

func NewBrowserReplayService(opts ...option.RequestOption) (r BrowserReplayService)

NewBrowserReplayService 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 (*BrowserReplayService) Download added in v0.8.0

func (r *BrowserReplayService) Download(ctx context.Context, replayID string, query BrowserReplayDownloadParams, opts ...option.RequestOption) (res *http.Response, err error)

Download or stream the specified replay recording.

func (*BrowserReplayService) List added in v0.8.0

List all replays for the specified browser session.

func (*BrowserReplayService) Start added in v0.8.0

Start recording the browser session and return a replay ID.

func (*BrowserReplayService) Stop added in v0.8.0

func (r *BrowserReplayService) Stop(ctx context.Context, replayID string, body BrowserReplayStopParams, opts ...option.RequestOption) (err error)

Stop the specified replay recording and persist the video.

type BrowserReplayStartParams added in v0.8.0

type BrowserReplayStartParams struct {
	// Recording framerate in fps.
	Framerate param.Opt[int64] `json:"framerate,omitzero"`
	// Maximum recording duration in seconds.
	MaxDurationInSeconds param.Opt[int64] `json:"max_duration_in_seconds,omitzero"`
	// contains filtered or unexported fields
}

func (BrowserReplayStartParams) MarshalJSON added in v0.8.0

func (r BrowserReplayStartParams) MarshalJSON() (data []byte, err error)

func (*BrowserReplayStartParams) UnmarshalJSON added in v0.8.0

func (r *BrowserReplayStartParams) UnmarshalJSON(data []byte) error

type BrowserReplayStartResponse added in v0.8.0

type BrowserReplayStartResponse struct {
	// Unique identifier for the replay recording.
	ReplayID string `json:"replay_id,required"`
	// Timestamp when replay finished
	FinishedAt time.Time `json:"finished_at,nullable" format:"date-time"`
	// URL for viewing the replay recording.
	ReplayViewURL string `json:"replay_view_url"`
	// Timestamp when replay started
	StartedAt time.Time `json:"started_at,nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ReplayID      respjson.Field
		FinishedAt    respjson.Field
		ReplayViewURL respjson.Field
		StartedAt     respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about a browser replay recording.

func (BrowserReplayStartResponse) RawJSON added in v0.8.0

func (r BrowserReplayStartResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BrowserReplayStartResponse) UnmarshalJSON added in v0.8.0

func (r *BrowserReplayStartResponse) UnmarshalJSON(data []byte) error

type BrowserReplayStopParams added in v0.8.0

type BrowserReplayStopParams struct {
	ID string `path:"id,required" json:"-"`
	// contains filtered or unexported fields
}

type BrowserService

type BrowserService struct {
	Options []option.RequestOption
	Replays BrowserReplayService
	Fs      BrowserFService
	Process BrowserProcessService
	Logs    BrowserLogService
}

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) Delete added in v0.3.0

func (r *BrowserService) Delete(ctx context.Context, body BrowserDeleteParams, opts ...option.RequestOption) (err error)

Delete a persistent browser session by its persistent_id.

func (*BrowserService) DeleteByID added in v0.3.0

func (r *BrowserService) DeleteByID(ctx context.Context, id string, opts ...option.RequestOption) (err error)

Delete a browser session by ID

func (*BrowserService) Get

func (r *BrowserService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *BrowserGetResponse, err error)

Get information about a browser session.

func (*BrowserService) List added in v0.3.0

func (r *BrowserService) List(ctx context.Context, opts ...option.RequestOption) (res *[]BrowserListResponse, err error)

List active browser sessions

func (*BrowserService) New

Create a new browser session from within an action.

type Client

type Client struct {
	Options     []option.RequestOption
	Deployments DeploymentService
	Apps        AppService
	Invocations InvocationService
	Browsers    BrowserService
	Profiles    ProfileService
	Proxies     ProxyService
}

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.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type DeploymentFollowParams added in v0.6.2

type DeploymentFollowParams struct {
	// Show logs since the given time (RFC timestamps or durations like 5m).
	Since param.Opt[string] `query:"since,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (DeploymentFollowParams) URLQuery added in v0.6.2

func (r DeploymentFollowParams) URLQuery() (v url.Values, err error)

URLQuery serializes DeploymentFollowParams's query parameters as `url.Values`.

type DeploymentFollowResponseAppVersionSummaryEvent added in v0.6.0

type DeploymentFollowResponseAppVersionSummaryEvent struct {
	// Unique identifier for the app version
	ID string `json:"id,required"`
	// List of actions available on the app
	Actions []shared.AppAction `json:"actions,required"`
	// Name of the application
	AppName string `json:"app_name,required"`
	// Event type identifier (always "app_version_summary").
	Event constant.AppVersionSummary `json:"event,required"`
	// Deployment region code
	Region constant.AwsUsEast1a `json:"region,required"`
	// Time the state was reported.
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// 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
		Actions     respjson.Field
		AppName     respjson.Field
		Event       respjson.Field
		Region      respjson.Field
		Timestamp   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 (DeploymentFollowResponseAppVersionSummaryEvent) RawJSON added in v0.6.0

Returns the unmodified JSON received from the API

func (*DeploymentFollowResponseAppVersionSummaryEvent) UnmarshalJSON added in v0.6.0

type DeploymentFollowResponseUnion added in v0.6.0

type DeploymentFollowResponseUnion struct {
	// Any of "log", "deployment_state", nil, nil, "sse_heartbeat".
	Event string `json:"event"`
	// This field is from variant [shared.LogEvent].
	Message   string    `json:"message"`
	Timestamp time.Time `json:"timestamp"`
	// This field is from variant [DeploymentStateEvent].
	Deployment DeploymentStateEventDeployment `json:"deployment"`
	// This field is from variant [DeploymentFollowResponseAppVersionSummaryEvent].
	ID string `json:"id"`
	// This field is from variant [DeploymentFollowResponseAppVersionSummaryEvent].
	Actions []shared.AppAction `json:"actions"`
	// This field is from variant [DeploymentFollowResponseAppVersionSummaryEvent].
	AppName string `json:"app_name"`
	// This field is from variant [DeploymentFollowResponseAppVersionSummaryEvent].
	Region constant.AwsUsEast1a `json:"region"`
	// This field is from variant [DeploymentFollowResponseAppVersionSummaryEvent].
	Version string `json:"version"`
	// This field is from variant [DeploymentFollowResponseAppVersionSummaryEvent].
	EnvVars map[string]string `json:"env_vars"`
	// This field is from variant [shared.ErrorEvent].
	Error shared.ErrorModel `json:"error"`
	JSON  struct {
		Event      respjson.Field
		Message    respjson.Field
		Timestamp  respjson.Field
		Deployment respjson.Field
		ID         respjson.Field
		Actions    respjson.Field
		AppName    respjson.Field
		Region     respjson.Field
		Version    respjson.Field
		EnvVars    respjson.Field
		Error      respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

DeploymentFollowResponseUnion contains all possible properties and values from shared.LogEvent, DeploymentStateEvent, DeploymentFollowResponseAppVersionSummaryEvent, shared.ErrorEvent, shared.HeartbeatEvent.

Use the [DeploymentFollowResponseUnion.AsAny] method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (DeploymentFollowResponseUnion) AsDeploymentFollowResponseAppVersionSummaryEvent added in v0.6.0

func (u DeploymentFollowResponseUnion) AsDeploymentFollowResponseAppVersionSummaryEvent() (v DeploymentFollowResponseAppVersionSummaryEvent)

func (DeploymentFollowResponseUnion) AsDeploymentState added in v0.6.0

func (u DeploymentFollowResponseUnion) AsDeploymentState() (v DeploymentStateEvent)

func (DeploymentFollowResponseUnion) AsErrorEvent added in v0.6.0

func (u DeploymentFollowResponseUnion) AsErrorEvent() (v shared.ErrorEvent)

func (DeploymentFollowResponseUnion) AsLog added in v0.6.0

func (DeploymentFollowResponseUnion) AsSseHeartbeat added in v0.6.2

func (u DeploymentFollowResponseUnion) AsSseHeartbeat() (v shared.HeartbeatEvent)

func (DeploymentFollowResponseUnion) RawJSON added in v0.6.0

Returns the unmodified JSON received from the API

func (*DeploymentFollowResponseUnion) UnmarshalJSON added in v0.6.0

func (r *DeploymentFollowResponseUnion) UnmarshalJSON(data []byte) error

type DeploymentGetResponse added in v0.6.0

type DeploymentGetResponse struct {
	// Unique identifier for the deployment
	ID string `json:"id,required"`
	// Timestamp when the deployment was created
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Deployment region code
	Region constant.AwsUsEast1a `json:"region,required"`
	// Current status of the deployment
	//
	// Any of "queued", "in_progress", "running", "failed", "stopped".
	Status DeploymentGetResponseStatus `json:"status,required"`
	// Relative path to the application entrypoint
	EntrypointRelPath string `json:"entrypoint_rel_path"`
	// Environment variables configured for this deployment
	EnvVars map[string]string `json:"env_vars"`
	// Status reason
	StatusReason string `json:"status_reason"`
	// Timestamp when the deployment was last updated
	UpdatedAt time.Time `json:"updated_at,nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		CreatedAt         respjson.Field
		Region            respjson.Field
		Status            respjson.Field
		EntrypointRelPath respjson.Field
		EnvVars           respjson.Field
		StatusReason      respjson.Field
		UpdatedAt         respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Deployment record information.

func (DeploymentGetResponse) RawJSON added in v0.6.0

func (r DeploymentGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*DeploymentGetResponse) UnmarshalJSON added in v0.6.0

func (r *DeploymentGetResponse) UnmarshalJSON(data []byte) error

type DeploymentGetResponseStatus added in v0.6.0

type DeploymentGetResponseStatus string

Current status of the deployment

const (
	DeploymentGetResponseStatusQueued     DeploymentGetResponseStatus = "queued"
	DeploymentGetResponseStatusInProgress DeploymentGetResponseStatus = "in_progress"
	DeploymentGetResponseStatusRunning    DeploymentGetResponseStatus = "running"
	DeploymentGetResponseStatusFailed     DeploymentGetResponseStatus = "failed"
	DeploymentGetResponseStatusStopped    DeploymentGetResponseStatus = "stopped"
)

type DeploymentListParams added in v0.6.4

type DeploymentListParams struct {
	// Filter results by application name.
	AppName param.Opt[string] `query:"app_name,omitzero" json:"-"`
	// Limit the number of deployments to return.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Offset the number of deployments to return.
	Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (DeploymentListParams) URLQuery added in v0.6.4

func (r DeploymentListParams) URLQuery() (v url.Values, err error)

URLQuery serializes DeploymentListParams's query parameters as `url.Values`.

type DeploymentListResponse added in v0.6.4

type DeploymentListResponse struct {
	// Unique identifier for the deployment
	ID string `json:"id,required"`
	// Timestamp when the deployment was created
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Deployment region code
	Region constant.AwsUsEast1a `json:"region,required"`
	// Current status of the deployment
	//
	// Any of "queued", "in_progress", "running", "failed", "stopped".
	Status DeploymentListResponseStatus `json:"status,required"`
	// Relative path to the application entrypoint
	EntrypointRelPath string `json:"entrypoint_rel_path"`
	// Environment variables configured for this deployment
	EnvVars map[string]string `json:"env_vars"`
	// Status reason
	StatusReason string `json:"status_reason"`
	// Timestamp when the deployment was last updated
	UpdatedAt time.Time `json:"updated_at,nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		CreatedAt         respjson.Field
		Region            respjson.Field
		Status            respjson.Field
		EntrypointRelPath respjson.Field
		EnvVars           respjson.Field
		StatusReason      respjson.Field
		UpdatedAt         respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Deployment record information.

func (DeploymentListResponse) RawJSON added in v0.6.4

func (r DeploymentListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*DeploymentListResponse) UnmarshalJSON added in v0.6.4

func (r *DeploymentListResponse) UnmarshalJSON(data []byte) error

type DeploymentListResponseStatus added in v0.6.4

type DeploymentListResponseStatus string

Current status of the deployment

const (
	DeploymentListResponseStatusQueued     DeploymentListResponseStatus = "queued"
	DeploymentListResponseStatusInProgress DeploymentListResponseStatus = "in_progress"
	DeploymentListResponseStatusRunning    DeploymentListResponseStatus = "running"
	DeploymentListResponseStatusFailed     DeploymentListResponseStatus = "failed"
	DeploymentListResponseStatusStopped    DeploymentListResponseStatus = "stopped"
)

type DeploymentNewParams added in v0.6.0

type DeploymentNewParams 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 DeploymentNewParamsRegion `json:"region,omitzero"`
	// contains filtered or unexported fields
}

func (DeploymentNewParams) MarshalMultipart added in v0.6.0

func (r DeploymentNewParams) MarshalMultipart() (data []byte, contentType string, err error)

type DeploymentNewParamsRegion added in v0.6.0

type DeploymentNewParamsRegion string

Region for deployment. Currently we only support "aws.us-east-1a"

const (
	DeploymentNewParamsRegionAwsUsEast1a DeploymentNewParamsRegion = "aws.us-east-1a"
)

type DeploymentNewResponse added in v0.6.0

type DeploymentNewResponse struct {
	// Unique identifier for the deployment
	ID string `json:"id,required"`
	// Timestamp when the deployment was created
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Deployment region code
	Region constant.AwsUsEast1a `json:"region,required"`
	// Current status of the deployment
	//
	// Any of "queued", "in_progress", "running", "failed", "stopped".
	Status DeploymentNewResponseStatus `json:"status,required"`
	// Relative path to the application entrypoint
	EntrypointRelPath string `json:"entrypoint_rel_path"`
	// Environment variables configured for this deployment
	EnvVars map[string]string `json:"env_vars"`
	// Status reason
	StatusReason string `json:"status_reason"`
	// Timestamp when the deployment was last updated
	UpdatedAt time.Time `json:"updated_at,nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		CreatedAt         respjson.Field
		Region            respjson.Field
		Status            respjson.Field
		EntrypointRelPath respjson.Field
		EnvVars           respjson.Field
		StatusReason      respjson.Field
		UpdatedAt         respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Deployment record information.

func (DeploymentNewResponse) RawJSON added in v0.6.0

func (r DeploymentNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*DeploymentNewResponse) UnmarshalJSON added in v0.6.0

func (r *DeploymentNewResponse) UnmarshalJSON(data []byte) error

type DeploymentNewResponseStatus added in v0.6.0

type DeploymentNewResponseStatus string

Current status of the deployment

const (
	DeploymentNewResponseStatusQueued     DeploymentNewResponseStatus = "queued"
	DeploymentNewResponseStatusInProgress DeploymentNewResponseStatus = "in_progress"
	DeploymentNewResponseStatusRunning    DeploymentNewResponseStatus = "running"
	DeploymentNewResponseStatusFailed     DeploymentNewResponseStatus = "failed"
	DeploymentNewResponseStatusStopped    DeploymentNewResponseStatus = "stopped"
)

type DeploymentService added in v0.6.0

type DeploymentService struct {
	Options []option.RequestOption
}

DeploymentService 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 NewDeploymentService method instead.

func NewDeploymentService added in v0.6.0

func NewDeploymentService(opts ...option.RequestOption) (r DeploymentService)

NewDeploymentService 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 (*DeploymentService) FollowStreaming added in v0.6.0

Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and status updates for a deployment. The stream terminates automatically once the deployment reaches a terminal state.

func (*DeploymentService) Get added in v0.6.0

Get information about a deployment's status.

func (*DeploymentService) List added in v0.6.4

List deployments. Optionally filter by application name.

func (*DeploymentService) ListAutoPaging added in v0.11.2

List deployments. Optionally filter by application name.

func (*DeploymentService) New added in v0.6.0

Create a new deployment.

type DeploymentStateEvent added in v0.6.0

type DeploymentStateEvent struct {
	// Deployment record information.
	Deployment DeploymentStateEventDeployment `json:"deployment,required"`
	// Event type identifier (always "deployment_state").
	Event constant.DeploymentState `json:"event,required"`
	// Time the state was reported.
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Deployment  respjson.Field
		Event       respjson.Field
		Timestamp   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An event representing the current state of a deployment.

func (DeploymentStateEvent) RawJSON added in v0.6.0

func (r DeploymentStateEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*DeploymentStateEvent) UnmarshalJSON added in v0.6.0

func (r *DeploymentStateEvent) UnmarshalJSON(data []byte) error

type DeploymentStateEventDeployment added in v0.6.0

type DeploymentStateEventDeployment struct {
	// Unique identifier for the deployment
	ID string `json:"id,required"`
	// Timestamp when the deployment was created
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Deployment region code
	Region constant.AwsUsEast1a `json:"region,required"`
	// Current status of the deployment
	//
	// Any of "queued", "in_progress", "running", "failed", "stopped".
	Status string `json:"status,required"`
	// Relative path to the application entrypoint
	EntrypointRelPath string `json:"entrypoint_rel_path"`
	// Environment variables configured for this deployment
	EnvVars map[string]string `json:"env_vars"`
	// Status reason
	StatusReason string `json:"status_reason"`
	// Timestamp when the deployment was last updated
	UpdatedAt time.Time `json:"updated_at,nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		CreatedAt         respjson.Field
		Region            respjson.Field
		Status            respjson.Field
		EntrypointRelPath respjson.Field
		EnvVars           respjson.Field
		StatusReason      respjson.Field
		UpdatedAt         respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Deployment record information.

func (DeploymentStateEventDeployment) RawJSON added in v0.6.0

Returns the unmodified JSON received from the API

func (*DeploymentStateEventDeployment) UnmarshalJSON added in v0.6.0

func (r *DeploymentStateEventDeployment) UnmarshalJSON(data []byte) error

type Error

type Error = apierror.Error

type ErrorDetail added in v0.6.0

type ErrorDetail = shared.ErrorDetail

This is an alias to an internal type.

type ErrorEvent added in v0.6.0

type ErrorEvent = shared.ErrorEvent

An error event from the application.

This is an alias to an internal type.

type ErrorModel added in v0.6.0

type ErrorModel = shared.ErrorModel

This is an alias to an internal type.

type HeartbeatEvent added in v0.6.2

type HeartbeatEvent = shared.HeartbeatEvent

Heartbeat event sent periodically to keep SSE connection alive.

This is an alias to an internal type.

type InvocationFollowParams added in v0.11.3

type InvocationFollowParams struct {
	// Show logs since the given time (RFC timestamps or durations like 5m).
	Since param.Opt[string] `query:"since,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (InvocationFollowParams) URLQuery added in v0.11.3

func (r InvocationFollowParams) URLQuery() (v url.Values, err error)

URLQuery serializes InvocationFollowParams's query parameters as `url.Values`.

type InvocationFollowResponseUnion added in v0.6.0

type InvocationFollowResponseUnion struct {
	// Any of "log", "invocation_state", "error", "sse_heartbeat".
	Event string `json:"event"`
	// This field is from variant [shared.LogEvent].
	Message   string    `json:"message"`
	Timestamp time.Time `json:"timestamp"`
	// This field is from variant [InvocationStateEvent].
	Invocation InvocationStateEventInvocation `json:"invocation"`
	// This field is from variant [shared.ErrorEvent].
	Error shared.ErrorModel `json:"error"`
	JSON  struct {
		Event      respjson.Field
		Message    respjson.Field
		Timestamp  respjson.Field
		Invocation respjson.Field
		Error      respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

InvocationFollowResponseUnion contains all possible properties and values from shared.LogEvent, InvocationStateEvent, shared.ErrorEvent, shared.HeartbeatEvent.

Use the InvocationFollowResponseUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (InvocationFollowResponseUnion) AsAny added in v0.6.0

func (u InvocationFollowResponseUnion) AsAny() anyInvocationFollowResponse

Use the following switch statement to find the correct variant

switch variant := InvocationFollowResponseUnion.AsAny().(type) {
case shared.LogEvent:
case kernel.InvocationStateEvent:
case shared.ErrorEvent:
case shared.HeartbeatEvent:
default:
  fmt.Errorf("no variant present")
}

func (InvocationFollowResponseUnion) AsError added in v0.6.0

func (InvocationFollowResponseUnion) AsInvocationState added in v0.6.0

func (u InvocationFollowResponseUnion) AsInvocationState() (v InvocationStateEvent)

func (InvocationFollowResponseUnion) AsLog added in v0.6.0

func (InvocationFollowResponseUnion) AsSseHeartbeat added in v0.6.2

func (u InvocationFollowResponseUnion) AsSseHeartbeat() (v shared.HeartbeatEvent)

func (InvocationFollowResponseUnion) RawJSON added in v0.6.0

Returns the unmodified JSON received from the API

func (*InvocationFollowResponseUnion) UnmarshalJSON added in v0.6.0

func (r *InvocationFollowResponseUnion) UnmarshalJSON(data []byte) error

type InvocationGetResponse added in v0.6.0

type InvocationGetResponse 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 InvocationGetResponseStatus `json:"status,required"`
	// Version label for the application
	Version string `json:"version,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
		Version      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 (InvocationGetResponse) RawJSON added in v0.6.0

func (r InvocationGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InvocationGetResponse) UnmarshalJSON added in v0.6.0

func (r *InvocationGetResponse) UnmarshalJSON(data []byte) error

type InvocationGetResponseStatus added in v0.6.0

type InvocationGetResponseStatus string

Status of the invocation

const (
	InvocationGetResponseStatusQueued    InvocationGetResponseStatus = "queued"
	InvocationGetResponseStatusRunning   InvocationGetResponseStatus = "running"
	InvocationGetResponseStatusSucceeded InvocationGetResponseStatus = "succeeded"
	InvocationGetResponseStatusFailed    InvocationGetResponseStatus = "failed"
)

type InvocationListParams added in v0.11.5

type InvocationListParams struct {
	// Filter results by action name.
	ActionName param.Opt[string] `query:"action_name,omitzero" json:"-"`
	// Filter results by application name.
	AppName param.Opt[string] `query:"app_name,omitzero" json:"-"`
	// Filter results by deployment ID.
	DeploymentID param.Opt[string] `query:"deployment_id,omitzero" json:"-"`
	// Limit the number of invocations to return.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Offset the number of invocations to return.
	Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
	// Show invocations that have started since the given time (RFC timestamps or
	// durations like 5m).
	Since param.Opt[string] `query:"since,omitzero" json:"-"`
	// Filter results by application version.
	Version param.Opt[string] `query:"version,omitzero" json:"-"`
	// Filter results by invocation status.
	//
	// Any of "queued", "running", "succeeded", "failed".
	Status InvocationListParamsStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (InvocationListParams) URLQuery added in v0.11.5

func (r InvocationListParams) URLQuery() (v url.Values, err error)

URLQuery serializes InvocationListParams's query parameters as `url.Values`.

type InvocationListParamsStatus added in v0.11.5

type InvocationListParamsStatus string

Filter results by invocation status.

const (
	InvocationListParamsStatusQueued    InvocationListParamsStatus = "queued"
	InvocationListParamsStatusRunning   InvocationListParamsStatus = "running"
	InvocationListParamsStatusSucceeded InvocationListParamsStatus = "succeeded"
	InvocationListParamsStatusFailed    InvocationListParamsStatus = "failed"
)

type InvocationListResponse added in v0.11.5

type InvocationListResponse 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 InvocationListResponseStatus `json:"status,required"`
	// Version label for the application
	Version string `json:"version,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
		Version      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 (InvocationListResponse) RawJSON added in v0.11.5

func (r InvocationListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InvocationListResponse) UnmarshalJSON added in v0.11.5

func (r *InvocationListResponse) UnmarshalJSON(data []byte) error

type InvocationListResponseStatus added in v0.11.5

type InvocationListResponseStatus string

Status of the invocation

const (
	InvocationListResponseStatusQueued    InvocationListResponseStatus = "queued"
	InvocationListResponseStatusRunning   InvocationListResponseStatus = "running"
	InvocationListResponseStatusSucceeded InvocationListResponseStatus = "succeeded"
	InvocationListResponseStatusFailed    InvocationListResponseStatus = "failed"
)

type InvocationNewParams added in v0.6.0

type InvocationNewParams 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"`
	// If true, invoke asynchronously. When set, the API responds 202 Accepted with
	// status "queued".
	Async param.Opt[bool] `json:"async,omitzero"`
	// Input data for the action, sent as a JSON string.
	Payload param.Opt[string] `json:"payload,omitzero"`
	// contains filtered or unexported fields
}

func (InvocationNewParams) MarshalJSON added in v0.6.0

func (r InvocationNewParams) MarshalJSON() (data []byte, err error)

func (*InvocationNewParams) UnmarshalJSON added in v0.6.0

func (r *InvocationNewParams) UnmarshalJSON(data []byte) error

type InvocationNewResponse added in v0.6.0

type InvocationNewResponse struct {
	// ID of the invocation
	ID string `json:"id,required"`
	// Name of the action invoked
	ActionName string `json:"action_name,required"`
	// Status of the invocation
	//
	// Any of "queued", "running", "succeeded", "failed".
	Status InvocationNewResponseStatus `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
		ActionName   respjson.Field
		Status       respjson.Field
		Output       respjson.Field
		StatusReason respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InvocationNewResponse) RawJSON added in v0.6.0

func (r InvocationNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InvocationNewResponse) UnmarshalJSON added in v0.6.0

func (r *InvocationNewResponse) UnmarshalJSON(data []byte) error

type InvocationNewResponseStatus added in v0.6.0

type InvocationNewResponseStatus string

Status of the invocation

const (
	InvocationNewResponseStatusQueued    InvocationNewResponseStatus = "queued"
	InvocationNewResponseStatusRunning   InvocationNewResponseStatus = "running"
	InvocationNewResponseStatusSucceeded InvocationNewResponseStatus = "succeeded"
	InvocationNewResponseStatusFailed    InvocationNewResponseStatus = "failed"
)

type InvocationService added in v0.6.0

type InvocationService struct {
	Options []option.RequestOption
}

InvocationService 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 NewInvocationService method instead.

func NewInvocationService added in v0.6.0

func NewInvocationService(opts ...option.RequestOption) (r InvocationService)

NewInvocationService 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 (*InvocationService) DeleteBrowsers added in v0.6.1

func (r *InvocationService) DeleteBrowsers(ctx context.Context, id string, opts ...option.RequestOption) (err error)

Delete all browser sessions created within the specified invocation.

func (*InvocationService) FollowStreaming added in v0.6.0

Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and status updates for an invocation. The stream terminates automatically once the invocation reaches a terminal state.

func (*InvocationService) Get added in v0.6.0

Get details about an invocation's status and output.

func (*InvocationService) List added in v0.11.5

List invocations. Optionally filter by application name, action name, status, deployment ID, or start time.

func (*InvocationService) ListAutoPaging added in v0.11.5

List invocations. Optionally filter by application name, action name, status, deployment ID, or start time.

func (*InvocationService) New added in v0.6.0

Invoke an action.

func (*InvocationService) Update added in v0.6.0

Update an invocation's status or output. This can be used to cancel an invocation by setting the status to "failed".

type InvocationStateEvent added in v0.6.0

type InvocationStateEvent struct {
	// Event type identifier (always "invocation_state").
	Event      constant.InvocationState       `json:"event,required"`
	Invocation InvocationStateEventInvocation `json:"invocation,required"`
	// Time the state was reported.
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Event       respjson.Field
		Invocation  respjson.Field
		Timestamp   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An event representing the current state of an invocation.

func (InvocationStateEvent) ImplInvocationFollowResponseUnion added in v0.6.0

func (InvocationStateEvent) ImplInvocationFollowResponseUnion()

func (InvocationStateEvent) RawJSON added in v0.6.0

func (r InvocationStateEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*InvocationStateEvent) UnmarshalJSON added in v0.6.0

func (r *InvocationStateEvent) UnmarshalJSON(data []byte) error

type InvocationStateEventInvocation added in v0.6.0

type InvocationStateEventInvocation 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 string `json:"status,required"`
	// Version label for the application
	Version string `json:"version,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
		Version      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 (InvocationStateEventInvocation) RawJSON added in v0.6.0

Returns the unmodified JSON received from the API

func (*InvocationStateEventInvocation) UnmarshalJSON added in v0.6.0

func (r *InvocationStateEventInvocation) UnmarshalJSON(data []byte) error

type InvocationUpdateParams added in v0.6.0

type InvocationUpdateParams struct {
	// New status for the invocation.
	//
	// Any of "succeeded", "failed".
	Status InvocationUpdateParamsStatus `json:"status,omitzero,required"`
	// Updated output of the invocation rendered as JSON string.
	Output param.Opt[string] `json:"output,omitzero"`
	// contains filtered or unexported fields
}

func (InvocationUpdateParams) MarshalJSON added in v0.6.0

func (r InvocationUpdateParams) MarshalJSON() (data []byte, err error)

func (*InvocationUpdateParams) UnmarshalJSON added in v0.6.0

func (r *InvocationUpdateParams) UnmarshalJSON(data []byte) error

type InvocationUpdateParamsStatus added in v0.6.0

type InvocationUpdateParamsStatus string

New status for the invocation.

const (
	InvocationUpdateParamsStatusSucceeded InvocationUpdateParamsStatus = "succeeded"
	InvocationUpdateParamsStatusFailed    InvocationUpdateParamsStatus = "failed"
)

type InvocationUpdateResponse added in v0.6.0

type InvocationUpdateResponse 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 InvocationUpdateResponseStatus `json:"status,required"`
	// Version label for the application
	Version string `json:"version,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
		Version      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 (InvocationUpdateResponse) RawJSON added in v0.6.0

func (r InvocationUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InvocationUpdateResponse) UnmarshalJSON added in v0.6.0

func (r *InvocationUpdateResponse) UnmarshalJSON(data []byte) error

type InvocationUpdateResponseStatus added in v0.6.0

type InvocationUpdateResponseStatus string

Status of the invocation

const (
	InvocationUpdateResponseStatusQueued    InvocationUpdateResponseStatus = "queued"
	InvocationUpdateResponseStatusRunning   InvocationUpdateResponseStatus = "running"
	InvocationUpdateResponseStatusSucceeded InvocationUpdateResponseStatus = "succeeded"
	InvocationUpdateResponseStatusFailed    InvocationUpdateResponseStatus = "failed"
)

type LogEvent added in v0.6.0

type LogEvent = shared.LogEvent

A log entry from the application.

This is an alias to an internal type.

type Profile added in v0.11.2

type Profile struct {
	// Unique identifier for the profile
	ID string `json:"id,required"`
	// Timestamp when the profile was created
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Timestamp when the profile was last used
	LastUsedAt time.Time `json:"last_used_at" format:"date-time"`
	// Optional, easier-to-reference name for the profile
	Name string `json:"name,nullable"`
	// Timestamp when the profile was last updated
	UpdatedAt time.Time `json:"updated_at" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		LastUsedAt  respjson.Field
		Name        respjson.Field
		UpdatedAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Browser profile metadata.

func (Profile) RawJSON added in v0.11.2

func (r Profile) RawJSON() string

Returns the unmodified JSON received from the API

func (*Profile) UnmarshalJSON added in v0.11.2

func (r *Profile) UnmarshalJSON(data []byte) error

type ProfileNewParams added in v0.11.2

type ProfileNewParams struct {
	// Optional name of the profile. Must be unique within the organization.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (ProfileNewParams) MarshalJSON added in v0.11.2

func (r ProfileNewParams) MarshalJSON() (data []byte, err error)

func (*ProfileNewParams) UnmarshalJSON added in v0.11.2

func (r *ProfileNewParams) UnmarshalJSON(data []byte) error

type ProfileService added in v0.11.2

type ProfileService struct {
	Options []option.RequestOption
}

ProfileService 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 NewProfileService method instead.

func NewProfileService added in v0.11.2

func NewProfileService(opts ...option.RequestOption) (r ProfileService)

NewProfileService 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 (*ProfileService) Delete added in v0.11.2

func (r *ProfileService) Delete(ctx context.Context, idOrName string, opts ...option.RequestOption) (err error)

Delete a profile by its ID or by its name.

func (*ProfileService) Download added in v0.11.2

func (r *ProfileService) Download(ctx context.Context, idOrName string, opts ...option.RequestOption) (res *http.Response, err error)

Download the profile. Profiles are JSON files containing the pieces of state that we save.

func (*ProfileService) Get added in v0.11.2

func (r *ProfileService) Get(ctx context.Context, idOrName string, opts ...option.RequestOption) (res *Profile, err error)

Retrieve details for a single profile by its ID or name.

func (*ProfileService) List added in v0.11.2

func (r *ProfileService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Profile, err error)

List profiles with optional filtering and pagination.

func (*ProfileService) New added in v0.11.2

func (r *ProfileService) New(ctx context.Context, body ProfileNewParams, opts ...option.RequestOption) (res *Profile, err error)

Create a browser profile that can be used to load state into future browser sessions.

type ProxyGetResponse added in v0.11.2

type ProxyGetResponse struct {
	// Proxy type to use. In terms of quality for avoiding bot-detection, from best to
	// worst: `mobile` > `residential` > `isp` > `datacenter`.
	//
	// Any of "datacenter", "isp", "residential", "mobile", "custom".
	Type ProxyGetResponseType `json:"type,required"`
	ID   string               `json:"id"`
	// Configuration specific to the selected proxy `type`.
	Config ProxyGetResponseConfigUnion `json:"config"`
	// Timestamp of the last health check performed on this proxy.
	LastChecked time.Time `json:"last_checked" format:"date-time"`
	// Readable name of the proxy.
	Name string `json:"name"`
	// Protocol to use for the proxy connection.
	//
	// Any of "http", "https".
	Protocol ProxyGetResponseProtocol `json:"protocol"`
	// Current health status of the proxy.
	//
	// Any of "available", "unavailable".
	Status ProxyGetResponseStatus `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ID          respjson.Field
		Config      respjson.Field
		LastChecked respjson.Field
		Name        respjson.Field
		Protocol    respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for routing traffic through a proxy.

func (ProxyGetResponse) RawJSON added in v0.11.2

func (r ProxyGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ProxyGetResponse) UnmarshalJSON added in v0.11.2

func (r *ProxyGetResponse) UnmarshalJSON(data []byte) error

type ProxyGetResponseConfigCustomProxyConfig added in v0.11.2

type ProxyGetResponseConfigCustomProxyConfig struct {
	// Proxy host address or IP.
	Host string `json:"host,required"`
	// Proxy port.
	Port int64 `json:"port,required"`
	// Whether the proxy has a password.
	HasPassword bool `json:"has_password"`
	// Username for proxy authentication.
	Username string `json:"username"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Host        respjson.Field
		Port        respjson.Field
		HasPassword respjson.Field
		Username    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for a custom proxy (e.g., private proxy server).

func (ProxyGetResponseConfigCustomProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyGetResponseConfigCustomProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyGetResponseConfigCustomProxyConfig) UnmarshalJSON(data []byte) error

type ProxyGetResponseConfigDatacenterProxyConfig added in v0.11.2

type ProxyGetResponseConfigDatacenterProxyConfig struct {
	// ISO 3166 country code or EU for the proxy exit node.
	Country string `json:"country,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Country     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for a datacenter proxy.

func (ProxyGetResponseConfigDatacenterProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyGetResponseConfigDatacenterProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyGetResponseConfigDatacenterProxyConfig) UnmarshalJSON(data []byte) error

type ProxyGetResponseConfigIspProxyConfig added in v0.11.2

type ProxyGetResponseConfigIspProxyConfig struct {
	// ISO 3166 country code or EU for the proxy exit node.
	Country string `json:"country,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Country     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for an ISP proxy.

func (ProxyGetResponseConfigIspProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyGetResponseConfigIspProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyGetResponseConfigIspProxyConfig) UnmarshalJSON(data []byte) error

type ProxyGetResponseConfigMobileProxyConfig added in v0.11.2

type ProxyGetResponseConfigMobileProxyConfig struct {
	// Autonomous system number. See https://bgp.potaroo.net/cidr/autnums.html
	Asn string `json:"asn"`
	// Mobile carrier.
	//
	// Any of "a1", "aircel", "airtel", "att", "celcom", "chinamobile", "claro",
	// "comcast", "cox", "digi", "dt", "docomo", "dtac", "etisalat", "idea",
	// "kyivstar", "meo", "megafon", "mtn", "mtnza", "mts", "optus", "orange", "qwest",
	// "reliance_jio", "robi", "sprint", "telefonica", "telstra", "tmobile", "tigo",
	// "tim", "verizon", "vimpelcom", "vodacomza", "vodafone", "vivo", "zain",
	// "vivabo", "telenormyanmar", "kcelljsc", "swisscom", "singtel", "asiacell",
	// "windit", "cellc", "ooredoo", "drei", "umobile", "cableone", "proximus",
	// "tele2", "mobitel", "o2", "bouygues", "free", "sfr", "digicel".
	Carrier string `json:"carrier"`
	// City name (no spaces, e.g. `sanfrancisco`). If provided, `country` must also be
	// provided.
	City string `json:"city"`
	// ISO 3166 country code or EU for the proxy exit node. Required if `city` is
	// provided.
	Country string `json:"country"`
	// Two-letter state code.
	State string `json:"state"`
	// US ZIP code.
	Zip string `json:"zip"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Asn         respjson.Field
		Carrier     respjson.Field
		City        respjson.Field
		Country     respjson.Field
		State       respjson.Field
		Zip         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for mobile proxies.

func (ProxyGetResponseConfigMobileProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyGetResponseConfigMobileProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyGetResponseConfigMobileProxyConfig) UnmarshalJSON(data []byte) error

type ProxyGetResponseConfigResidentialProxyConfig added in v0.11.2

type ProxyGetResponseConfigResidentialProxyConfig struct {
	// Autonomous system number. See https://bgp.potaroo.net/cidr/autnums.html
	Asn string `json:"asn"`
	// City name (no spaces, e.g. `sanfrancisco`). If provided, `country` must also be
	// provided.
	City string `json:"city"`
	// ISO 3166 country code or EU for the proxy exit node. Required if `city` is
	// provided.
	Country string `json:"country"`
	// Operating system of the residential device.
	//
	// Any of "windows", "macos", "android".
	Os string `json:"os"`
	// Two-letter state code.
	State string `json:"state"`
	// US ZIP code.
	Zip string `json:"zip"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Asn         respjson.Field
		City        respjson.Field
		Country     respjson.Field
		Os          respjson.Field
		State       respjson.Field
		Zip         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for residential proxies.

func (ProxyGetResponseConfigResidentialProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyGetResponseConfigResidentialProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyGetResponseConfigResidentialProxyConfig) UnmarshalJSON(data []byte) error

type ProxyGetResponseConfigUnion added in v0.11.2

type ProxyGetResponseConfigUnion struct {
	Country string `json:"country"`
	Asn     string `json:"asn"`
	City    string `json:"city"`
	// This field is from variant [ProxyGetResponseConfigResidentialProxyConfig].
	Os    string `json:"os"`
	State string `json:"state"`
	Zip   string `json:"zip"`
	// This field is from variant [ProxyGetResponseConfigMobileProxyConfig].
	Carrier string `json:"carrier"`
	// This field is from variant [ProxyGetResponseConfigCustomProxyConfig].
	Host string `json:"host"`
	// This field is from variant [ProxyGetResponseConfigCustomProxyConfig].
	Port int64 `json:"port"`
	// This field is from variant [ProxyGetResponseConfigCustomProxyConfig].
	HasPassword bool `json:"has_password"`
	// This field is from variant [ProxyGetResponseConfigCustomProxyConfig].
	Username string `json:"username"`
	JSON     struct {
		Country     respjson.Field
		Asn         respjson.Field
		City        respjson.Field
		Os          respjson.Field
		State       respjson.Field
		Zip         respjson.Field
		Carrier     respjson.Field
		Host        respjson.Field
		Port        respjson.Field
		HasPassword respjson.Field
		Username    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ProxyGetResponseConfigUnion contains all possible properties and values from ProxyGetResponseConfigDatacenterProxyConfig, ProxyGetResponseConfigIspProxyConfig, ProxyGetResponseConfigResidentialProxyConfig, ProxyGetResponseConfigMobileProxyConfig, ProxyGetResponseConfigCustomProxyConfig.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ProxyGetResponseConfigUnion) AsProxyGetResponseConfigCustomProxyConfig added in v0.11.2

func (u ProxyGetResponseConfigUnion) AsProxyGetResponseConfigCustomProxyConfig() (v ProxyGetResponseConfigCustomProxyConfig)

func (ProxyGetResponseConfigUnion) AsProxyGetResponseConfigDatacenterProxyConfig added in v0.11.2

func (u ProxyGetResponseConfigUnion) AsProxyGetResponseConfigDatacenterProxyConfig() (v ProxyGetResponseConfigDatacenterProxyConfig)

func (ProxyGetResponseConfigUnion) AsProxyGetResponseConfigIspProxyConfig added in v0.11.2

func (u ProxyGetResponseConfigUnion) AsProxyGetResponseConfigIspProxyConfig() (v ProxyGetResponseConfigIspProxyConfig)

func (ProxyGetResponseConfigUnion) AsProxyGetResponseConfigMobileProxyConfig added in v0.11.2

func (u ProxyGetResponseConfigUnion) AsProxyGetResponseConfigMobileProxyConfig() (v ProxyGetResponseConfigMobileProxyConfig)

func (ProxyGetResponseConfigUnion) AsProxyGetResponseConfigResidentialProxyConfig added in v0.11.2

func (u ProxyGetResponseConfigUnion) AsProxyGetResponseConfigResidentialProxyConfig() (v ProxyGetResponseConfigResidentialProxyConfig)

func (ProxyGetResponseConfigUnion) RawJSON added in v0.11.2

func (u ProxyGetResponseConfigUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ProxyGetResponseConfigUnion) UnmarshalJSON added in v0.11.2

func (r *ProxyGetResponseConfigUnion) UnmarshalJSON(data []byte) error

type ProxyGetResponseProtocol added in v0.14.0

type ProxyGetResponseProtocol string

Protocol to use for the proxy connection.

const (
	ProxyGetResponseProtocolHTTP  ProxyGetResponseProtocol = "http"
	ProxyGetResponseProtocolHTTPS ProxyGetResponseProtocol = "https"
)

type ProxyGetResponseStatus added in v0.14.0

type ProxyGetResponseStatus string

Current health status of the proxy.

const (
	ProxyGetResponseStatusAvailable   ProxyGetResponseStatus = "available"
	ProxyGetResponseStatusUnavailable ProxyGetResponseStatus = "unavailable"
)

type ProxyGetResponseType added in v0.11.2

type ProxyGetResponseType string

Proxy type to use. In terms of quality for avoiding bot-detection, from best to worst: `mobile` > `residential` > `isp` > `datacenter`.

const (
	ProxyGetResponseTypeDatacenter  ProxyGetResponseType = "datacenter"
	ProxyGetResponseTypeIsp         ProxyGetResponseType = "isp"
	ProxyGetResponseTypeResidential ProxyGetResponseType = "residential"
	ProxyGetResponseTypeMobile      ProxyGetResponseType = "mobile"
	ProxyGetResponseTypeCustom      ProxyGetResponseType = "custom"
)

type ProxyListResponse added in v0.11.2

type ProxyListResponse struct {
	// Proxy type to use. In terms of quality for avoiding bot-detection, from best to
	// worst: `mobile` > `residential` > `isp` > `datacenter`.
	//
	// Any of "datacenter", "isp", "residential", "mobile", "custom".
	Type ProxyListResponseType `json:"type,required"`
	ID   string                `json:"id"`
	// Configuration specific to the selected proxy `type`.
	Config ProxyListResponseConfigUnion `json:"config"`
	// Timestamp of the last health check performed on this proxy.
	LastChecked time.Time `json:"last_checked" format:"date-time"`
	// Readable name of the proxy.
	Name string `json:"name"`
	// Protocol to use for the proxy connection.
	//
	// Any of "http", "https".
	Protocol ProxyListResponseProtocol `json:"protocol"`
	// Current health status of the proxy.
	//
	// Any of "available", "unavailable".
	Status ProxyListResponseStatus `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ID          respjson.Field
		Config      respjson.Field
		LastChecked respjson.Field
		Name        respjson.Field
		Protocol    respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for routing traffic through a proxy.

func (ProxyListResponse) RawJSON added in v0.11.2

func (r ProxyListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ProxyListResponse) UnmarshalJSON added in v0.11.2

func (r *ProxyListResponse) UnmarshalJSON(data []byte) error

type ProxyListResponseConfigCustomProxyConfig added in v0.11.2

type ProxyListResponseConfigCustomProxyConfig struct {
	// Proxy host address or IP.
	Host string `json:"host,required"`
	// Proxy port.
	Port int64 `json:"port,required"`
	// Whether the proxy has a password.
	HasPassword bool `json:"has_password"`
	// Username for proxy authentication.
	Username string `json:"username"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Host        respjson.Field
		Port        respjson.Field
		HasPassword respjson.Field
		Username    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for a custom proxy (e.g., private proxy server).

func (ProxyListResponseConfigCustomProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyListResponseConfigCustomProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyListResponseConfigCustomProxyConfig) UnmarshalJSON(data []byte) error

type ProxyListResponseConfigDatacenterProxyConfig added in v0.11.2

type ProxyListResponseConfigDatacenterProxyConfig struct {
	// ISO 3166 country code or EU for the proxy exit node.
	Country string `json:"country,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Country     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for a datacenter proxy.

func (ProxyListResponseConfigDatacenterProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyListResponseConfigDatacenterProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyListResponseConfigDatacenterProxyConfig) UnmarshalJSON(data []byte) error

type ProxyListResponseConfigIspProxyConfig added in v0.11.2

type ProxyListResponseConfigIspProxyConfig struct {
	// ISO 3166 country code or EU for the proxy exit node.
	Country string `json:"country,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Country     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for an ISP proxy.

func (ProxyListResponseConfigIspProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyListResponseConfigIspProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyListResponseConfigIspProxyConfig) UnmarshalJSON(data []byte) error

type ProxyListResponseConfigMobileProxyConfig added in v0.11.2

type ProxyListResponseConfigMobileProxyConfig struct {
	// Autonomous system number. See https://bgp.potaroo.net/cidr/autnums.html
	Asn string `json:"asn"`
	// Mobile carrier.
	//
	// Any of "a1", "aircel", "airtel", "att", "celcom", "chinamobile", "claro",
	// "comcast", "cox", "digi", "dt", "docomo", "dtac", "etisalat", "idea",
	// "kyivstar", "meo", "megafon", "mtn", "mtnza", "mts", "optus", "orange", "qwest",
	// "reliance_jio", "robi", "sprint", "telefonica", "telstra", "tmobile", "tigo",
	// "tim", "verizon", "vimpelcom", "vodacomza", "vodafone", "vivo", "zain",
	// "vivabo", "telenormyanmar", "kcelljsc", "swisscom", "singtel", "asiacell",
	// "windit", "cellc", "ooredoo", "drei", "umobile", "cableone", "proximus",
	// "tele2", "mobitel", "o2", "bouygues", "free", "sfr", "digicel".
	Carrier string `json:"carrier"`
	// City name (no spaces, e.g. `sanfrancisco`). If provided, `country` must also be
	// provided.
	City string `json:"city"`
	// ISO 3166 country code or EU for the proxy exit node. Required if `city` is
	// provided.
	Country string `json:"country"`
	// Two-letter state code.
	State string `json:"state"`
	// US ZIP code.
	Zip string `json:"zip"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Asn         respjson.Field
		Carrier     respjson.Field
		City        respjson.Field
		Country     respjson.Field
		State       respjson.Field
		Zip         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for mobile proxies.

func (ProxyListResponseConfigMobileProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyListResponseConfigMobileProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyListResponseConfigMobileProxyConfig) UnmarshalJSON(data []byte) error

type ProxyListResponseConfigResidentialProxyConfig added in v0.11.2

type ProxyListResponseConfigResidentialProxyConfig struct {
	// Autonomous system number. See https://bgp.potaroo.net/cidr/autnums.html
	Asn string `json:"asn"`
	// City name (no spaces, e.g. `sanfrancisco`). If provided, `country` must also be
	// provided.
	City string `json:"city"`
	// ISO 3166 country code or EU for the proxy exit node. Required if `city` is
	// provided.
	Country string `json:"country"`
	// Operating system of the residential device.
	//
	// Any of "windows", "macos", "android".
	Os string `json:"os"`
	// Two-letter state code.
	State string `json:"state"`
	// US ZIP code.
	Zip string `json:"zip"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Asn         respjson.Field
		City        respjson.Field
		Country     respjson.Field
		Os          respjson.Field
		State       respjson.Field
		Zip         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for residential proxies.

func (ProxyListResponseConfigResidentialProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyListResponseConfigResidentialProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyListResponseConfigResidentialProxyConfig) UnmarshalJSON(data []byte) error

type ProxyListResponseConfigUnion added in v0.11.2

type ProxyListResponseConfigUnion struct {
	Country string `json:"country"`
	Asn     string `json:"asn"`
	City    string `json:"city"`
	// This field is from variant [ProxyListResponseConfigResidentialProxyConfig].
	Os    string `json:"os"`
	State string `json:"state"`
	Zip   string `json:"zip"`
	// This field is from variant [ProxyListResponseConfigMobileProxyConfig].
	Carrier string `json:"carrier"`
	// This field is from variant [ProxyListResponseConfigCustomProxyConfig].
	Host string `json:"host"`
	// This field is from variant [ProxyListResponseConfigCustomProxyConfig].
	Port int64 `json:"port"`
	// This field is from variant [ProxyListResponseConfigCustomProxyConfig].
	HasPassword bool `json:"has_password"`
	// This field is from variant [ProxyListResponseConfigCustomProxyConfig].
	Username string `json:"username"`
	JSON     struct {
		Country     respjson.Field
		Asn         respjson.Field
		City        respjson.Field
		Os          respjson.Field
		State       respjson.Field
		Zip         respjson.Field
		Carrier     respjson.Field
		Host        respjson.Field
		Port        respjson.Field
		HasPassword respjson.Field
		Username    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ProxyListResponseConfigUnion contains all possible properties and values from ProxyListResponseConfigDatacenterProxyConfig, ProxyListResponseConfigIspProxyConfig, ProxyListResponseConfigResidentialProxyConfig, ProxyListResponseConfigMobileProxyConfig, ProxyListResponseConfigCustomProxyConfig.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ProxyListResponseConfigUnion) AsProxyListResponseConfigCustomProxyConfig added in v0.11.2

func (u ProxyListResponseConfigUnion) AsProxyListResponseConfigCustomProxyConfig() (v ProxyListResponseConfigCustomProxyConfig)

func (ProxyListResponseConfigUnion) AsProxyListResponseConfigDatacenterProxyConfig added in v0.11.2

func (u ProxyListResponseConfigUnion) AsProxyListResponseConfigDatacenterProxyConfig() (v ProxyListResponseConfigDatacenterProxyConfig)

func (ProxyListResponseConfigUnion) AsProxyListResponseConfigIspProxyConfig added in v0.11.2

func (u ProxyListResponseConfigUnion) AsProxyListResponseConfigIspProxyConfig() (v ProxyListResponseConfigIspProxyConfig)

func (ProxyListResponseConfigUnion) AsProxyListResponseConfigMobileProxyConfig added in v0.11.2

func (u ProxyListResponseConfigUnion) AsProxyListResponseConfigMobileProxyConfig() (v ProxyListResponseConfigMobileProxyConfig)

func (ProxyListResponseConfigUnion) AsProxyListResponseConfigResidentialProxyConfig added in v0.11.2

func (u ProxyListResponseConfigUnion) AsProxyListResponseConfigResidentialProxyConfig() (v ProxyListResponseConfigResidentialProxyConfig)

func (ProxyListResponseConfigUnion) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyListResponseConfigUnion) UnmarshalJSON added in v0.11.2

func (r *ProxyListResponseConfigUnion) UnmarshalJSON(data []byte) error

type ProxyListResponseProtocol added in v0.14.0

type ProxyListResponseProtocol string

Protocol to use for the proxy connection.

const (
	ProxyListResponseProtocolHTTP  ProxyListResponseProtocol = "http"
	ProxyListResponseProtocolHTTPS ProxyListResponseProtocol = "https"
)

type ProxyListResponseStatus added in v0.14.0

type ProxyListResponseStatus string

Current health status of the proxy.

const (
	ProxyListResponseStatusAvailable   ProxyListResponseStatus = "available"
	ProxyListResponseStatusUnavailable ProxyListResponseStatus = "unavailable"
)

type ProxyListResponseType added in v0.11.2

type ProxyListResponseType string

Proxy type to use. In terms of quality for avoiding bot-detection, from best to worst: `mobile` > `residential` > `isp` > `datacenter`.

const (
	ProxyListResponseTypeDatacenter  ProxyListResponseType = "datacenter"
	ProxyListResponseTypeIsp         ProxyListResponseType = "isp"
	ProxyListResponseTypeResidential ProxyListResponseType = "residential"
	ProxyListResponseTypeMobile      ProxyListResponseType = "mobile"
	ProxyListResponseTypeCustom      ProxyListResponseType = "custom"
)

type ProxyNewParams added in v0.11.2

type ProxyNewParams struct {
	// Proxy type to use. In terms of quality for avoiding bot-detection, from best to
	// worst: `mobile` > `residential` > `isp` > `datacenter`.
	//
	// Any of "datacenter", "isp", "residential", "mobile", "custom".
	Type ProxyNewParamsType `json:"type,omitzero,required"`
	// Readable name of the proxy.
	Name param.Opt[string] `json:"name,omitzero"`
	// Configuration specific to the selected proxy `type`.
	Config ProxyNewParamsConfigUnion `json:"config,omitzero"`
	// Protocol to use for the proxy connection.
	//
	// Any of "http", "https".
	Protocol ProxyNewParamsProtocol `json:"protocol,omitzero"`
	// contains filtered or unexported fields
}

func (ProxyNewParams) MarshalJSON added in v0.11.2

func (r ProxyNewParams) MarshalJSON() (data []byte, err error)

func (*ProxyNewParams) UnmarshalJSON added in v0.11.2

func (r *ProxyNewParams) UnmarshalJSON(data []byte) error

type ProxyNewParamsConfigCreateCustomProxyConfig added in v0.11.2

type ProxyNewParamsConfigCreateCustomProxyConfig struct {
	// Proxy host address or IP.
	Host string `json:"host,required"`
	// Proxy port.
	Port int64 `json:"port,required"`
	// Password for proxy authentication.
	Password param.Opt[string] `json:"password,omitzero"`
	// Username for proxy authentication.
	Username param.Opt[string] `json:"username,omitzero"`
	// contains filtered or unexported fields
}

Configuration for a custom proxy (e.g., private proxy server).

The properties Host, Port are required.

func (ProxyNewParamsConfigCreateCustomProxyConfig) MarshalJSON added in v0.11.2

func (r ProxyNewParamsConfigCreateCustomProxyConfig) MarshalJSON() (data []byte, err error)

func (*ProxyNewParamsConfigCreateCustomProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyNewParamsConfigCreateCustomProxyConfig) UnmarshalJSON(data []byte) error

type ProxyNewParamsConfigDatacenterProxyConfig added in v0.11.2

type ProxyNewParamsConfigDatacenterProxyConfig struct {
	// ISO 3166 country code or EU for the proxy exit node.
	Country string `json:"country,required"`
	// contains filtered or unexported fields
}

Configuration for a datacenter proxy.

The property Country is required.

func (ProxyNewParamsConfigDatacenterProxyConfig) MarshalJSON added in v0.11.2

func (r ProxyNewParamsConfigDatacenterProxyConfig) MarshalJSON() (data []byte, err error)

func (*ProxyNewParamsConfigDatacenterProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyNewParamsConfigDatacenterProxyConfig) UnmarshalJSON(data []byte) error

type ProxyNewParamsConfigIspProxyConfig added in v0.11.2

type ProxyNewParamsConfigIspProxyConfig struct {
	// ISO 3166 country code or EU for the proxy exit node.
	Country string `json:"country,required"`
	// contains filtered or unexported fields
}

Configuration for an ISP proxy.

The property Country is required.

func (ProxyNewParamsConfigIspProxyConfig) MarshalJSON added in v0.11.2

func (r ProxyNewParamsConfigIspProxyConfig) MarshalJSON() (data []byte, err error)

func (*ProxyNewParamsConfigIspProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyNewParamsConfigIspProxyConfig) UnmarshalJSON(data []byte) error

type ProxyNewParamsConfigMobileProxyConfig added in v0.11.2

type ProxyNewParamsConfigMobileProxyConfig struct {
	// Autonomous system number. See https://bgp.potaroo.net/cidr/autnums.html
	Asn param.Opt[string] `json:"asn,omitzero"`
	// City name (no spaces, e.g. `sanfrancisco`). If provided, `country` must also be
	// provided.
	City param.Opt[string] `json:"city,omitzero"`
	// ISO 3166 country code or EU for the proxy exit node. Required if `city` is
	// provided.
	Country param.Opt[string] `json:"country,omitzero"`
	// Two-letter state code.
	State param.Opt[string] `json:"state,omitzero"`
	// US ZIP code.
	Zip param.Opt[string] `json:"zip,omitzero"`
	// Mobile carrier.
	//
	// Any of "a1", "aircel", "airtel", "att", "celcom", "chinamobile", "claro",
	// "comcast", "cox", "digi", "dt", "docomo", "dtac", "etisalat", "idea",
	// "kyivstar", "meo", "megafon", "mtn", "mtnza", "mts", "optus", "orange", "qwest",
	// "reliance_jio", "robi", "sprint", "telefonica", "telstra", "tmobile", "tigo",
	// "tim", "verizon", "vimpelcom", "vodacomza", "vodafone", "vivo", "zain",
	// "vivabo", "telenormyanmar", "kcelljsc", "swisscom", "singtel", "asiacell",
	// "windit", "cellc", "ooredoo", "drei", "umobile", "cableone", "proximus",
	// "tele2", "mobitel", "o2", "bouygues", "free", "sfr", "digicel".
	Carrier string `json:"carrier,omitzero"`
	// contains filtered or unexported fields
}

Configuration for mobile proxies.

func (ProxyNewParamsConfigMobileProxyConfig) MarshalJSON added in v0.11.2

func (r ProxyNewParamsConfigMobileProxyConfig) MarshalJSON() (data []byte, err error)

func (*ProxyNewParamsConfigMobileProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyNewParamsConfigMobileProxyConfig) UnmarshalJSON(data []byte) error

type ProxyNewParamsConfigResidentialProxyConfig added in v0.11.2

type ProxyNewParamsConfigResidentialProxyConfig struct {
	// Autonomous system number. See https://bgp.potaroo.net/cidr/autnums.html
	Asn param.Opt[string] `json:"asn,omitzero"`
	// City name (no spaces, e.g. `sanfrancisco`). If provided, `country` must also be
	// provided.
	City param.Opt[string] `json:"city,omitzero"`
	// ISO 3166 country code or EU for the proxy exit node. Required if `city` is
	// provided.
	Country param.Opt[string] `json:"country,omitzero"`
	// Two-letter state code.
	State param.Opt[string] `json:"state,omitzero"`
	// US ZIP code.
	Zip param.Opt[string] `json:"zip,omitzero"`
	// Operating system of the residential device.
	//
	// Any of "windows", "macos", "android".
	Os string `json:"os,omitzero"`
	// contains filtered or unexported fields
}

Configuration for residential proxies.

func (ProxyNewParamsConfigResidentialProxyConfig) MarshalJSON added in v0.11.2

func (r ProxyNewParamsConfigResidentialProxyConfig) MarshalJSON() (data []byte, err error)

func (*ProxyNewParamsConfigResidentialProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyNewParamsConfigResidentialProxyConfig) UnmarshalJSON(data []byte) error

type ProxyNewParamsConfigUnion added in v0.11.2

type ProxyNewParamsConfigUnion struct {
	OfProxyNewsConfigDatacenterProxyConfig   *ProxyNewParamsConfigDatacenterProxyConfig   `json:",omitzero,inline"`
	OfProxyNewsConfigIspProxyConfig          *ProxyNewParamsConfigIspProxyConfig          `json:",omitzero,inline"`
	OfProxyNewsConfigResidentialProxyConfig  *ProxyNewParamsConfigResidentialProxyConfig  `json:",omitzero,inline"`
	OfProxyNewsConfigMobileProxyConfig       *ProxyNewParamsConfigMobileProxyConfig       `json:",omitzero,inline"`
	OfProxyNewsConfigCreateCustomProxyConfig *ProxyNewParamsConfigCreateCustomProxyConfig `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 (ProxyNewParamsConfigUnion) GetAsn added in v0.11.2

func (u ProxyNewParamsConfigUnion) GetAsn() *string

Returns a pointer to the underlying variant's property, if present.

func (ProxyNewParamsConfigUnion) GetCarrier added in v0.11.2

func (u ProxyNewParamsConfigUnion) GetCarrier() *string

Returns a pointer to the underlying variant's property, if present.

func (ProxyNewParamsConfigUnion) GetCity added in v0.11.2

func (u ProxyNewParamsConfigUnion) GetCity() *string

Returns a pointer to the underlying variant's property, if present.

func (ProxyNewParamsConfigUnion) GetCountry added in v0.11.2

func (u ProxyNewParamsConfigUnion) GetCountry() *string

Returns a pointer to the underlying variant's property, if present.

func (ProxyNewParamsConfigUnion) GetHost added in v0.11.2

func (u ProxyNewParamsConfigUnion) GetHost() *string

Returns a pointer to the underlying variant's property, if present.

func (ProxyNewParamsConfigUnion) GetOs added in v0.11.2

func (u ProxyNewParamsConfigUnion) GetOs() *string

Returns a pointer to the underlying variant's property, if present.

func (ProxyNewParamsConfigUnion) GetPassword added in v0.11.2

func (u ProxyNewParamsConfigUnion) GetPassword() *string

Returns a pointer to the underlying variant's property, if present.

func (ProxyNewParamsConfigUnion) GetPort added in v0.11.2

func (u ProxyNewParamsConfigUnion) GetPort() *int64

Returns a pointer to the underlying variant's property, if present.

func (ProxyNewParamsConfigUnion) GetState added in v0.11.2

func (u ProxyNewParamsConfigUnion) GetState() *string

Returns a pointer to the underlying variant's property, if present.

func (ProxyNewParamsConfigUnion) GetUsername added in v0.11.2

func (u ProxyNewParamsConfigUnion) GetUsername() *string

Returns a pointer to the underlying variant's property, if present.

func (ProxyNewParamsConfigUnion) GetZip added in v0.11.2

func (u ProxyNewParamsConfigUnion) GetZip() *string

Returns a pointer to the underlying variant's property, if present.

func (ProxyNewParamsConfigUnion) MarshalJSON added in v0.11.2

func (u ProxyNewParamsConfigUnion) MarshalJSON() ([]byte, error)

func (*ProxyNewParamsConfigUnion) UnmarshalJSON added in v0.11.2

func (u *ProxyNewParamsConfigUnion) UnmarshalJSON(data []byte) error

type ProxyNewParamsProtocol added in v0.14.0

type ProxyNewParamsProtocol string

Protocol to use for the proxy connection.

const (
	ProxyNewParamsProtocolHTTP  ProxyNewParamsProtocol = "http"
	ProxyNewParamsProtocolHTTPS ProxyNewParamsProtocol = "https"
)

type ProxyNewParamsType added in v0.11.2

type ProxyNewParamsType string

Proxy type to use. In terms of quality for avoiding bot-detection, from best to worst: `mobile` > `residential` > `isp` > `datacenter`.

const (
	ProxyNewParamsTypeDatacenter  ProxyNewParamsType = "datacenter"
	ProxyNewParamsTypeIsp         ProxyNewParamsType = "isp"
	ProxyNewParamsTypeResidential ProxyNewParamsType = "residential"
	ProxyNewParamsTypeMobile      ProxyNewParamsType = "mobile"
	ProxyNewParamsTypeCustom      ProxyNewParamsType = "custom"
)

type ProxyNewResponse added in v0.11.2

type ProxyNewResponse struct {
	// Proxy type to use. In terms of quality for avoiding bot-detection, from best to
	// worst: `mobile` > `residential` > `isp` > `datacenter`.
	//
	// Any of "datacenter", "isp", "residential", "mobile", "custom".
	Type ProxyNewResponseType `json:"type,required"`
	ID   string               `json:"id"`
	// Configuration specific to the selected proxy `type`.
	Config ProxyNewResponseConfigUnion `json:"config"`
	// Timestamp of the last health check performed on this proxy.
	LastChecked time.Time `json:"last_checked" format:"date-time"`
	// Readable name of the proxy.
	Name string `json:"name"`
	// Protocol to use for the proxy connection.
	//
	// Any of "http", "https".
	Protocol ProxyNewResponseProtocol `json:"protocol"`
	// Current health status of the proxy.
	//
	// Any of "available", "unavailable".
	Status ProxyNewResponseStatus `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ID          respjson.Field
		Config      respjson.Field
		LastChecked respjson.Field
		Name        respjson.Field
		Protocol    respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for routing traffic through a proxy.

func (ProxyNewResponse) RawJSON added in v0.11.2

func (r ProxyNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ProxyNewResponse) UnmarshalJSON added in v0.11.2

func (r *ProxyNewResponse) UnmarshalJSON(data []byte) error

type ProxyNewResponseConfigCustomProxyConfig added in v0.11.2

type ProxyNewResponseConfigCustomProxyConfig struct {
	// Proxy host address or IP.
	Host string `json:"host,required"`
	// Proxy port.
	Port int64 `json:"port,required"`
	// Whether the proxy has a password.
	HasPassword bool `json:"has_password"`
	// Username for proxy authentication.
	Username string `json:"username"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Host        respjson.Field
		Port        respjson.Field
		HasPassword respjson.Field
		Username    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for a custom proxy (e.g., private proxy server).

func (ProxyNewResponseConfigCustomProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyNewResponseConfigCustomProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyNewResponseConfigCustomProxyConfig) UnmarshalJSON(data []byte) error

type ProxyNewResponseConfigDatacenterProxyConfig added in v0.11.2

type ProxyNewResponseConfigDatacenterProxyConfig struct {
	// ISO 3166 country code or EU for the proxy exit node.
	Country string `json:"country,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Country     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for a datacenter proxy.

func (ProxyNewResponseConfigDatacenterProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyNewResponseConfigDatacenterProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyNewResponseConfigDatacenterProxyConfig) UnmarshalJSON(data []byte) error

type ProxyNewResponseConfigIspProxyConfig added in v0.11.2

type ProxyNewResponseConfigIspProxyConfig struct {
	// ISO 3166 country code or EU for the proxy exit node.
	Country string `json:"country,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Country     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for an ISP proxy.

func (ProxyNewResponseConfigIspProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyNewResponseConfigIspProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyNewResponseConfigIspProxyConfig) UnmarshalJSON(data []byte) error

type ProxyNewResponseConfigMobileProxyConfig added in v0.11.2

type ProxyNewResponseConfigMobileProxyConfig struct {
	// Autonomous system number. See https://bgp.potaroo.net/cidr/autnums.html
	Asn string `json:"asn"`
	// Mobile carrier.
	//
	// Any of "a1", "aircel", "airtel", "att", "celcom", "chinamobile", "claro",
	// "comcast", "cox", "digi", "dt", "docomo", "dtac", "etisalat", "idea",
	// "kyivstar", "meo", "megafon", "mtn", "mtnza", "mts", "optus", "orange", "qwest",
	// "reliance_jio", "robi", "sprint", "telefonica", "telstra", "tmobile", "tigo",
	// "tim", "verizon", "vimpelcom", "vodacomza", "vodafone", "vivo", "zain",
	// "vivabo", "telenormyanmar", "kcelljsc", "swisscom", "singtel", "asiacell",
	// "windit", "cellc", "ooredoo", "drei", "umobile", "cableone", "proximus",
	// "tele2", "mobitel", "o2", "bouygues", "free", "sfr", "digicel".
	Carrier string `json:"carrier"`
	// City name (no spaces, e.g. `sanfrancisco`). If provided, `country` must also be
	// provided.
	City string `json:"city"`
	// ISO 3166 country code or EU for the proxy exit node. Required if `city` is
	// provided.
	Country string `json:"country"`
	// Two-letter state code.
	State string `json:"state"`
	// US ZIP code.
	Zip string `json:"zip"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Asn         respjson.Field
		Carrier     respjson.Field
		City        respjson.Field
		Country     respjson.Field
		State       respjson.Field
		Zip         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for mobile proxies.

func (ProxyNewResponseConfigMobileProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyNewResponseConfigMobileProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyNewResponseConfigMobileProxyConfig) UnmarshalJSON(data []byte) error

type ProxyNewResponseConfigResidentialProxyConfig added in v0.11.2

type ProxyNewResponseConfigResidentialProxyConfig struct {
	// Autonomous system number. See https://bgp.potaroo.net/cidr/autnums.html
	Asn string `json:"asn"`
	// City name (no spaces, e.g. `sanfrancisco`). If provided, `country` must also be
	// provided.
	City string `json:"city"`
	// ISO 3166 country code or EU for the proxy exit node. Required if `city` is
	// provided.
	Country string `json:"country"`
	// Operating system of the residential device.
	//
	// Any of "windows", "macos", "android".
	Os string `json:"os"`
	// Two-letter state code.
	State string `json:"state"`
	// US ZIP code.
	Zip string `json:"zip"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Asn         respjson.Field
		City        respjson.Field
		Country     respjson.Field
		Os          respjson.Field
		State       respjson.Field
		Zip         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for residential proxies.

func (ProxyNewResponseConfigResidentialProxyConfig) RawJSON added in v0.11.2

Returns the unmodified JSON received from the API

func (*ProxyNewResponseConfigResidentialProxyConfig) UnmarshalJSON added in v0.11.2

func (r *ProxyNewResponseConfigResidentialProxyConfig) UnmarshalJSON(data []byte) error

type ProxyNewResponseConfigUnion added in v0.11.2

type ProxyNewResponseConfigUnion struct {
	Country string `json:"country"`
	Asn     string `json:"asn"`
	City    string `json:"city"`
	// This field is from variant [ProxyNewResponseConfigResidentialProxyConfig].
	Os    string `json:"os"`
	State string `json:"state"`
	Zip   string `json:"zip"`
	// This field is from variant [ProxyNewResponseConfigMobileProxyConfig].
	Carrier string `json:"carrier"`
	// This field is from variant [ProxyNewResponseConfigCustomProxyConfig].
	Host string `json:"host"`
	// This field is from variant [ProxyNewResponseConfigCustomProxyConfig].
	Port int64 `json:"port"`
	// This field is from variant [ProxyNewResponseConfigCustomProxyConfig].
	HasPassword bool `json:"has_password"`
	// This field is from variant [ProxyNewResponseConfigCustomProxyConfig].
	Username string `json:"username"`
	JSON     struct {
		Country     respjson.Field
		Asn         respjson.Field
		City        respjson.Field
		Os          respjson.Field
		State       respjson.Field
		Zip         respjson.Field
		Carrier     respjson.Field
		Host        respjson.Field
		Port        respjson.Field
		HasPassword respjson.Field
		Username    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ProxyNewResponseConfigUnion contains all possible properties and values from ProxyNewResponseConfigDatacenterProxyConfig, ProxyNewResponseConfigIspProxyConfig, ProxyNewResponseConfigResidentialProxyConfig, ProxyNewResponseConfigMobileProxyConfig, ProxyNewResponseConfigCustomProxyConfig.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ProxyNewResponseConfigUnion) AsProxyNewResponseConfigCustomProxyConfig added in v0.11.2

func (u ProxyNewResponseConfigUnion) AsProxyNewResponseConfigCustomProxyConfig() (v ProxyNewResponseConfigCustomProxyConfig)

func (ProxyNewResponseConfigUnion) AsProxyNewResponseConfigDatacenterProxyConfig added in v0.11.2

func (u ProxyNewResponseConfigUnion) AsProxyNewResponseConfigDatacenterProxyConfig() (v ProxyNewResponseConfigDatacenterProxyConfig)

func (ProxyNewResponseConfigUnion) AsProxyNewResponseConfigIspProxyConfig added in v0.11.2

func (u ProxyNewResponseConfigUnion) AsProxyNewResponseConfigIspProxyConfig() (v ProxyNewResponseConfigIspProxyConfig)

func (ProxyNewResponseConfigUnion) AsProxyNewResponseConfigMobileProxyConfig added in v0.11.2

func (u ProxyNewResponseConfigUnion) AsProxyNewResponseConfigMobileProxyConfig() (v ProxyNewResponseConfigMobileProxyConfig)

func (ProxyNewResponseConfigUnion) AsProxyNewResponseConfigResidentialProxyConfig added in v0.11.2

func (u ProxyNewResponseConfigUnion) AsProxyNewResponseConfigResidentialProxyConfig() (v ProxyNewResponseConfigResidentialProxyConfig)

func (ProxyNewResponseConfigUnion) RawJSON added in v0.11.2

func (u ProxyNewResponseConfigUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ProxyNewResponseConfigUnion) UnmarshalJSON added in v0.11.2

func (r *ProxyNewResponseConfigUnion) UnmarshalJSON(data []byte) error

type ProxyNewResponseProtocol added in v0.14.0

type ProxyNewResponseProtocol string

Protocol to use for the proxy connection.

const (
	ProxyNewResponseProtocolHTTP  ProxyNewResponseProtocol = "http"
	ProxyNewResponseProtocolHTTPS ProxyNewResponseProtocol = "https"
)

type ProxyNewResponseStatus added in v0.14.0

type ProxyNewResponseStatus string

Current health status of the proxy.

const (
	ProxyNewResponseStatusAvailable   ProxyNewResponseStatus = "available"
	ProxyNewResponseStatusUnavailable ProxyNewResponseStatus = "unavailable"
)

type ProxyNewResponseType added in v0.11.2

type ProxyNewResponseType string

Proxy type to use. In terms of quality for avoiding bot-detection, from best to worst: `mobile` > `residential` > `isp` > `datacenter`.

const (
	ProxyNewResponseTypeDatacenter  ProxyNewResponseType = "datacenter"
	ProxyNewResponseTypeIsp         ProxyNewResponseType = "isp"
	ProxyNewResponseTypeResidential ProxyNewResponseType = "residential"
	ProxyNewResponseTypeMobile      ProxyNewResponseType = "mobile"
	ProxyNewResponseTypeCustom      ProxyNewResponseType = "custom"
)

type ProxyService added in v0.11.2

type ProxyService struct {
	Options []option.RequestOption
}

ProxyService 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 NewProxyService method instead.

func NewProxyService added in v0.11.2

func NewProxyService(opts ...option.RequestOption) (r ProxyService)

NewProxyService 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 (*ProxyService) Delete added in v0.11.2

func (r *ProxyService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)

Soft delete a proxy. Sessions referencing it are not modified.

func (*ProxyService) Get added in v0.11.2

func (r *ProxyService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *ProxyGetResponse, err error)

Retrieve a proxy belonging to the caller's organization by ID.

func (*ProxyService) List added in v0.11.2

func (r *ProxyService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ProxyListResponse, err error)

List proxies owned by the caller's organization.

func (*ProxyService) New added in v0.11.2

func (r *ProxyService) New(ctx context.Context, body ProxyNewParams, opts ...option.RequestOption) (res *ProxyNewResponse, err error)

Create a new proxy configuration for the caller's organization.

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

Jump to

Keyboard shortcuts

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