agentmail

package module
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 18 Imported by: 2

README

Agentmail Go API Library

Go Reference

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

It is generated with Stainless.

Installation

import (
	"github.com/agentmail-to/agentmail-go" // imported as agentmail
)

Or to pin the version:

go get -u 'github.com/agentmail-to/agentmail-go@v0.11.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/agentmail-to/agentmail-go"
	"github.com/agentmail-to/agentmail-go/option"
)

func main() {
	client := agentmail.NewClient(
		option.WithAPIKey("My API Key"),     // defaults to os.LookupEnv("AGENTMAIL_API_KEY")
		option.WithEnvironmentDevelopment(), // defaults to option.WithEnvironmentProduction()
	)
	listInboxes, err := client.Inboxes.List(context.TODO(), agentmail.InboxListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", listInboxes.Count)
}

Request fields

The agentmail 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 `api:"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, agentmail.String(string), agentmail.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 := agentmail.ExampleParams{
	ID:   "id_xxx",                // required property
	Name: agentmail.String("..."), // optional property

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

	Origin: agentmail.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[agentmail.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of its 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 := agentmail.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Inboxes.List(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:

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.:

Errors

When the API returns a non-success status code, we return an error with type *agentmail.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.Inboxes.List(context.TODO(), agentmail.InboxListParams{})
if err != nil {
	var apierr *agentmail.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 "/v0/inboxes": 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.Inboxes.List(
	ctx,
	agentmail.InboxListParams{},
	// 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 agentmail.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.

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 := agentmail.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Inboxes.List(
	context.TODO(),
	agentmail.InboxListParams{},
	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
listInboxes, err := client.Inboxes.List(
	context.TODO(),
	agentmail.InboxListParams{},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", listInboxes)

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: agentmail.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 := agentmail.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 (AGENTMAIL_API_KEY, AGENTMAIL_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 APIKeyListParams

type APIKeyListParams struct {
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (APIKeyListParams) URLQuery

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

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

type APIKeyListResponse

type APIKeyListResponse struct {
	// Ordered by `created_at` descending.
	APIKeys []APIKeyListResponseAPIKey `json:"api_keys" api:"required"`
	// Number of items returned.
	Count int64 `json:"count" api:"required"`
	// Page token for pagination.
	NextPageToken string `json:"next_page_token" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKeys       respjson.Field
		Count         respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (APIKeyListResponse) RawJSON

func (r APIKeyListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*APIKeyListResponse) UnmarshalJSON

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

type APIKeyListResponseAPIKey

type APIKeyListResponseAPIKey struct {
	// ID of api key.
	APIKeyID string `json:"api_key_id" api:"required"`
	// Time at which api key was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Name of api key.
	Name string `json:"name" api:"required"`
	// Prefix of api key.
	Prefix string `json:"prefix" api:"required"`
	// Inbox ID the api key is scoped to. If set, the key can only access resources
	// within this inbox.
	InboxID string `json:"inbox_id" api:"nullable"`
	// Granular permissions for the API key. When ommitted all permissions are granted.
	// Otherwise, only permissions set to true are granted.
	Permissions APIKeyListResponseAPIKeyPermissions `json:"permissions" api:"nullable"`
	// Pod ID the api key is scoped to. If set, the key can only access resources
	// within this pod.
	PodID string `json:"pod_id" api:"nullable"`
	// Time at which api key was last used.
	UsedAt time.Time `json:"used_at" api:"nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKeyID    respjson.Field
		CreatedAt   respjson.Field
		Name        respjson.Field
		Prefix      respjson.Field
		InboxID     respjson.Field
		Permissions respjson.Field
		PodID       respjson.Field
		UsedAt      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (APIKeyListResponseAPIKey) RawJSON

func (r APIKeyListResponseAPIKey) RawJSON() string

Returns the unmodified JSON received from the API

func (*APIKeyListResponseAPIKey) UnmarshalJSON

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

type APIKeyListResponseAPIKeyPermissions added in v0.2.0

type APIKeyListResponseAPIKeyPermissions struct {
	// Create API keys.
	APIKeyCreate bool `json:"api_key_create" api:"nullable"`
	// Delete API keys.
	APIKeyDelete bool `json:"api_key_delete" api:"nullable"`
	// Read API keys.
	APIKeyRead bool `json:"api_key_read" api:"nullable"`
	// Create domains.
	DomainCreate bool `json:"domain_create" api:"nullable"`
	// Delete domains.
	DomainDelete bool `json:"domain_delete" api:"nullable"`
	// Read domain details.
	DomainRead bool `json:"domain_read" api:"nullable"`
	// Update domains.
	DomainUpdate bool `json:"domain_update" api:"nullable"`
	// Create drafts.
	DraftCreate bool `json:"draft_create" api:"nullable"`
	// Delete drafts.
	DraftDelete bool `json:"draft_delete" api:"nullable"`
	// Read drafts.
	DraftRead bool `json:"draft_read" api:"nullable"`
	// Send drafts.
	DraftSend bool `json:"draft_send" api:"nullable"`
	// Update drafts.
	DraftUpdate bool `json:"draft_update" api:"nullable"`
	// Create new inboxes.
	InboxCreate bool `json:"inbox_create" api:"nullable"`
	// Delete inboxes.
	InboxDelete bool `json:"inbox_delete" api:"nullable"`
	// Read inbox details.
	InboxRead bool `json:"inbox_read" api:"nullable"`
	// Update inbox settings.
	InboxUpdate bool `json:"inbox_update" api:"nullable"`
	// Access messages labeled blocked.
	LabelBlockedRead bool `json:"label_blocked_read" api:"nullable"`
	// Access messages labeled spam.
	LabelSpamRead bool `json:"label_spam_read" api:"nullable"`
	// Access messages labeled trash.
	LabelTrashRead bool `json:"label_trash_read" api:"nullable"`
	// Create list entries.
	ListEntryCreate bool `json:"list_entry_create" api:"nullable"`
	// Delete list entries.
	ListEntryDelete bool `json:"list_entry_delete" api:"nullable"`
	// Read list entries.
	ListEntryRead bool `json:"list_entry_read" api:"nullable"`
	// Read messages.
	MessageRead bool `json:"message_read" api:"nullable"`
	// Send messages.
	MessageSend bool `json:"message_send" api:"nullable"`
	// Update message labels.
	MessageUpdate bool `json:"message_update" api:"nullable"`
	// Read metrics.
	MetricsRead bool `json:"metrics_read" api:"nullable"`
	// Create pods.
	PodCreate bool `json:"pod_create" api:"nullable"`
	// Delete pods.
	PodDelete bool `json:"pod_delete" api:"nullable"`
	// Read pods.
	PodRead bool `json:"pod_read" api:"nullable"`
	// Delete threads.
	ThreadDelete bool `json:"thread_delete" api:"nullable"`
	// Read threads.
	ThreadRead bool `json:"thread_read" api:"nullable"`
	// Create webhooks.
	WebhookCreate bool `json:"webhook_create" api:"nullable"`
	// Delete webhooks.
	WebhookDelete bool `json:"webhook_delete" api:"nullable"`
	// Read webhook configurations.
	WebhookRead bool `json:"webhook_read" api:"nullable"`
	// Update webhooks.
	WebhookUpdate bool `json:"webhook_update" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKeyCreate     respjson.Field
		APIKeyDelete     respjson.Field
		APIKeyRead       respjson.Field
		DomainCreate     respjson.Field
		DomainDelete     respjson.Field
		DomainRead       respjson.Field
		DomainUpdate     respjson.Field
		DraftCreate      respjson.Field
		DraftDelete      respjson.Field
		DraftRead        respjson.Field
		DraftSend        respjson.Field
		DraftUpdate      respjson.Field
		InboxCreate      respjson.Field
		InboxDelete      respjson.Field
		InboxRead        respjson.Field
		InboxUpdate      respjson.Field
		LabelBlockedRead respjson.Field
		LabelSpamRead    respjson.Field
		LabelTrashRead   respjson.Field
		ListEntryCreate  respjson.Field
		ListEntryDelete  respjson.Field
		ListEntryRead    respjson.Field
		MessageRead      respjson.Field
		MessageSend      respjson.Field
		MessageUpdate    respjson.Field
		MetricsRead      respjson.Field
		PodCreate        respjson.Field
		PodDelete        respjson.Field
		PodRead          respjson.Field
		ThreadDelete     respjson.Field
		ThreadRead       respjson.Field
		WebhookCreate    respjson.Field
		WebhookDelete    respjson.Field
		WebhookRead      respjson.Field
		WebhookUpdate    respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Granular permissions for the API key. When ommitted all permissions are granted. Otherwise, only permissions set to true are granted.

func (APIKeyListResponseAPIKeyPermissions) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*APIKeyListResponseAPIKeyPermissions) UnmarshalJSON added in v0.2.0

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

type APIKeyNewParams

type APIKeyNewParams struct {
	// Name of api key.
	Name param.Opt[string] `json:"name,omitzero"`
	// Granular permissions for the API key. When ommitted all permissions are granted.
	// Otherwise, only permissions set to true are granted.
	Permissions APIKeyNewParamsPermissions `json:"permissions,omitzero"`
	// contains filtered or unexported fields
}

func (APIKeyNewParams) MarshalJSON

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

func (*APIKeyNewParams) UnmarshalJSON

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

type APIKeyNewParamsPermissions added in v0.2.0

type APIKeyNewParamsPermissions struct {
	// Create API keys.
	APIKeyCreate param.Opt[bool] `json:"api_key_create,omitzero"`
	// Delete API keys.
	APIKeyDelete param.Opt[bool] `json:"api_key_delete,omitzero"`
	// Read API keys.
	APIKeyRead param.Opt[bool] `json:"api_key_read,omitzero"`
	// Create domains.
	DomainCreate param.Opt[bool] `json:"domain_create,omitzero"`
	// Delete domains.
	DomainDelete param.Opt[bool] `json:"domain_delete,omitzero"`
	// Read domain details.
	DomainRead param.Opt[bool] `json:"domain_read,omitzero"`
	// Update domains.
	DomainUpdate param.Opt[bool] `json:"domain_update,omitzero"`
	// Create drafts.
	DraftCreate param.Opt[bool] `json:"draft_create,omitzero"`
	// Delete drafts.
	DraftDelete param.Opt[bool] `json:"draft_delete,omitzero"`
	// Read drafts.
	DraftRead param.Opt[bool] `json:"draft_read,omitzero"`
	// Send drafts.
	DraftSend param.Opt[bool] `json:"draft_send,omitzero"`
	// Update drafts.
	DraftUpdate param.Opt[bool] `json:"draft_update,omitzero"`
	// Create new inboxes.
	InboxCreate param.Opt[bool] `json:"inbox_create,omitzero"`
	// Delete inboxes.
	InboxDelete param.Opt[bool] `json:"inbox_delete,omitzero"`
	// Read inbox details.
	InboxRead param.Opt[bool] `json:"inbox_read,omitzero"`
	// Update inbox settings.
	InboxUpdate param.Opt[bool] `json:"inbox_update,omitzero"`
	// Access messages labeled blocked.
	LabelBlockedRead param.Opt[bool] `json:"label_blocked_read,omitzero"`
	// Access messages labeled spam.
	LabelSpamRead param.Opt[bool] `json:"label_spam_read,omitzero"`
	// Access messages labeled trash.
	LabelTrashRead param.Opt[bool] `json:"label_trash_read,omitzero"`
	// Create list entries.
	ListEntryCreate param.Opt[bool] `json:"list_entry_create,omitzero"`
	// Delete list entries.
	ListEntryDelete param.Opt[bool] `json:"list_entry_delete,omitzero"`
	// Read list entries.
	ListEntryRead param.Opt[bool] `json:"list_entry_read,omitzero"`
	// Read messages.
	MessageRead param.Opt[bool] `json:"message_read,omitzero"`
	// Send messages.
	MessageSend param.Opt[bool] `json:"message_send,omitzero"`
	// Update message labels.
	MessageUpdate param.Opt[bool] `json:"message_update,omitzero"`
	// Read metrics.
	MetricsRead param.Opt[bool] `json:"metrics_read,omitzero"`
	// Create pods.
	PodCreate param.Opt[bool] `json:"pod_create,omitzero"`
	// Delete pods.
	PodDelete param.Opt[bool] `json:"pod_delete,omitzero"`
	// Read pods.
	PodRead param.Opt[bool] `json:"pod_read,omitzero"`
	// Delete threads.
	ThreadDelete param.Opt[bool] `json:"thread_delete,omitzero"`
	// Read threads.
	ThreadRead param.Opt[bool] `json:"thread_read,omitzero"`
	// Create webhooks.
	WebhookCreate param.Opt[bool] `json:"webhook_create,omitzero"`
	// Delete webhooks.
	WebhookDelete param.Opt[bool] `json:"webhook_delete,omitzero"`
	// Read webhook configurations.
	WebhookRead param.Opt[bool] `json:"webhook_read,omitzero"`
	// Update webhooks.
	WebhookUpdate param.Opt[bool] `json:"webhook_update,omitzero"`
	// contains filtered or unexported fields
}

Granular permissions for the API key. When ommitted all permissions are granted. Otherwise, only permissions set to true are granted.

func (APIKeyNewParamsPermissions) MarshalJSON added in v0.2.0

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

func (*APIKeyNewParamsPermissions) UnmarshalJSON added in v0.2.0

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

type APIKeyNewResponse

type APIKeyNewResponse struct {
	// API key.
	APIKey string `json:"api_key" api:"required"`
	// ID of api key.
	APIKeyID string `json:"api_key_id" api:"required"`
	// Time at which api key was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Name of api key.
	Name string `json:"name" api:"required"`
	// Prefix of api key.
	Prefix string `json:"prefix" api:"required"`
	// Inbox ID the api key is scoped to.
	InboxID string `json:"inbox_id" api:"nullable"`
	// Granular permissions for the API key. When ommitted all permissions are granted.
	// Otherwise, only permissions set to true are granted.
	Permissions APIKeyNewResponsePermissions `json:"permissions" api:"nullable"`
	// Pod ID the api key is scoped to.
	PodID string `json:"pod_id" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKey      respjson.Field
		APIKeyID    respjson.Field
		CreatedAt   respjson.Field
		Name        respjson.Field
		Prefix      respjson.Field
		InboxID     respjson.Field
		Permissions respjson.Field
		PodID       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (APIKeyNewResponse) RawJSON

func (r APIKeyNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*APIKeyNewResponse) UnmarshalJSON

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

type APIKeyNewResponsePermissions added in v0.2.0

type APIKeyNewResponsePermissions struct {
	// Create API keys.
	APIKeyCreate bool `json:"api_key_create" api:"nullable"`
	// Delete API keys.
	APIKeyDelete bool `json:"api_key_delete" api:"nullable"`
	// Read API keys.
	APIKeyRead bool `json:"api_key_read" api:"nullable"`
	// Create domains.
	DomainCreate bool `json:"domain_create" api:"nullable"`
	// Delete domains.
	DomainDelete bool `json:"domain_delete" api:"nullable"`
	// Read domain details.
	DomainRead bool `json:"domain_read" api:"nullable"`
	// Update domains.
	DomainUpdate bool `json:"domain_update" api:"nullable"`
	// Create drafts.
	DraftCreate bool `json:"draft_create" api:"nullable"`
	// Delete drafts.
	DraftDelete bool `json:"draft_delete" api:"nullable"`
	// Read drafts.
	DraftRead bool `json:"draft_read" api:"nullable"`
	// Send drafts.
	DraftSend bool `json:"draft_send" api:"nullable"`
	// Update drafts.
	DraftUpdate bool `json:"draft_update" api:"nullable"`
	// Create new inboxes.
	InboxCreate bool `json:"inbox_create" api:"nullable"`
	// Delete inboxes.
	InboxDelete bool `json:"inbox_delete" api:"nullable"`
	// Read inbox details.
	InboxRead bool `json:"inbox_read" api:"nullable"`
	// Update inbox settings.
	InboxUpdate bool `json:"inbox_update" api:"nullable"`
	// Access messages labeled blocked.
	LabelBlockedRead bool `json:"label_blocked_read" api:"nullable"`
	// Access messages labeled spam.
	LabelSpamRead bool `json:"label_spam_read" api:"nullable"`
	// Access messages labeled trash.
	LabelTrashRead bool `json:"label_trash_read" api:"nullable"`
	// Create list entries.
	ListEntryCreate bool `json:"list_entry_create" api:"nullable"`
	// Delete list entries.
	ListEntryDelete bool `json:"list_entry_delete" api:"nullable"`
	// Read list entries.
	ListEntryRead bool `json:"list_entry_read" api:"nullable"`
	// Read messages.
	MessageRead bool `json:"message_read" api:"nullable"`
	// Send messages.
	MessageSend bool `json:"message_send" api:"nullable"`
	// Update message labels.
	MessageUpdate bool `json:"message_update" api:"nullable"`
	// Read metrics.
	MetricsRead bool `json:"metrics_read" api:"nullable"`
	// Create pods.
	PodCreate bool `json:"pod_create" api:"nullable"`
	// Delete pods.
	PodDelete bool `json:"pod_delete" api:"nullable"`
	// Read pods.
	PodRead bool `json:"pod_read" api:"nullable"`
	// Delete threads.
	ThreadDelete bool `json:"thread_delete" api:"nullable"`
	// Read threads.
	ThreadRead bool `json:"thread_read" api:"nullable"`
	// Create webhooks.
	WebhookCreate bool `json:"webhook_create" api:"nullable"`
	// Delete webhooks.
	WebhookDelete bool `json:"webhook_delete" api:"nullable"`
	// Read webhook configurations.
	WebhookRead bool `json:"webhook_read" api:"nullable"`
	// Update webhooks.
	WebhookUpdate bool `json:"webhook_update" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKeyCreate     respjson.Field
		APIKeyDelete     respjson.Field
		APIKeyRead       respjson.Field
		DomainCreate     respjson.Field
		DomainDelete     respjson.Field
		DomainRead       respjson.Field
		DomainUpdate     respjson.Field
		DraftCreate      respjson.Field
		DraftDelete      respjson.Field
		DraftRead        respjson.Field
		DraftSend        respjson.Field
		DraftUpdate      respjson.Field
		InboxCreate      respjson.Field
		InboxDelete      respjson.Field
		InboxRead        respjson.Field
		InboxUpdate      respjson.Field
		LabelBlockedRead respjson.Field
		LabelSpamRead    respjson.Field
		LabelTrashRead   respjson.Field
		ListEntryCreate  respjson.Field
		ListEntryDelete  respjson.Field
		ListEntryRead    respjson.Field
		MessageRead      respjson.Field
		MessageSend      respjson.Field
		MessageUpdate    respjson.Field
		MetricsRead      respjson.Field
		PodCreate        respjson.Field
		PodDelete        respjson.Field
		PodRead          respjson.Field
		ThreadDelete     respjson.Field
		ThreadRead       respjson.Field
		WebhookCreate    respjson.Field
		WebhookDelete    respjson.Field
		WebhookRead      respjson.Field
		WebhookUpdate    respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Granular permissions for the API key. When ommitted all permissions are granted. Otherwise, only permissions set to true are granted.

func (APIKeyNewResponsePermissions) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*APIKeyNewResponsePermissions) UnmarshalJSON added in v0.2.0

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

type APIKeyService

type APIKeyService struct {
	Options []option.RequestOption
}

APIKeyService contains methods and other services that help with interacting with the agentmail 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 NewAPIKeyService method instead.

func NewAPIKeyService

func NewAPIKeyService(opts ...option.RequestOption) (r APIKeyService)

NewAPIKeyService 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 (*APIKeyService) Delete

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

**CLI:**

```bash agentmail api-keys delete --api-key-id <api_key_id> ```

func (*APIKeyService) List

func (r *APIKeyService) List(ctx context.Context, query APIKeyListParams, opts ...option.RequestOption) (res *APIKeyListResponse, err error)

**CLI:**

```bash agentmail api-keys list ```

func (*APIKeyService) New

**CLI:**

```bash agentmail api-keys create --name "My Key" ```

type AddressesUnionParam

type AddressesUnionParam struct {
	OfString      param.Opt[string] `json:",omitzero,inline"`
	OfStringArray []string          `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 (AddressesUnionParam) MarshalJSON

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

func (*AddressesUnionParam) UnmarshalJSON

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

type AgentService added in v0.2.0

type AgentService struct {
	Options []option.RequestOption
}

AgentService contains methods and other services that help with interacting with the agentmail 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 NewAgentService method instead.

func NewAgentService added in v0.2.0

func NewAgentService(opts ...option.RequestOption) (r AgentService)

NewAgentService 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 (*AgentService) SignUp added in v0.2.0

func (r *AgentService) SignUp(ctx context.Context, body AgentSignUpParams, opts ...option.RequestOption) (res *AgentSignUpResponse, err error)

Create a new agent organization with an inbox and API key. This endpoint is for signing up for the first time. If you've already signed up, you're all set — just use your existing API key.

A 6-digit OTP is sent to the human's email for verification.

This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired.

The returned API key has limited permissions until the organization is verified via the verify endpoint.

**CLI:**

```bash agentmail agent sign-up --human-email user@example.com --username my-agent ```

func (*AgentService) Verify added in v0.2.0

func (r *AgentService) Verify(ctx context.Context, body AgentVerifyParams, opts ...option.RequestOption) (res *AgentVerifyResponse, err error)

Verify an agent organization using the 6-digit OTP sent to the human's email during sign-up.

On success, the organization is upgraded from `agent_unverified` to `agent_verified`, the send allowlist is removed, and free plan entitlements are applied.

The OTP expires after 24 hours and allows a maximum of 10 attempts.

**CLI:**

```bash agentmail agent verify --otp-code 123456 ```

type AgentSignUpParams added in v0.2.0

type AgentSignUpParams struct {
	// Email address of the human who owns the agent. A 6-digit OTP will be sent to
	// this address.
	HumanEmail string `json:"human_email" api:"required"`
	// Username for the auto-created inbox (e.g. "my-agent" creates
	// my-agent@agentmail.to).
	Username string `json:"username" api:"required"`
	// contains filtered or unexported fields
}

func (AgentSignUpParams) MarshalJSON added in v0.2.0

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

func (*AgentSignUpParams) UnmarshalJSON added in v0.2.0

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

type AgentSignUpResponse added in v0.4.0

type AgentSignUpResponse struct {
	// API key for authenticating subsequent requests. Store this securely, it cannot
	// be retrieved again.
	APIKey string `json:"api_key" api:"required"`
	// ID of the auto-created inbox.
	InboxID string `json:"inbox_id" api:"required"`
	// ID of the created organization.
	OrganizationID string `json:"organization_id" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKey         respjson.Field
		InboxID        respjson.Field
		OrganizationID respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response after successful agent sign-up.

func (AgentSignUpResponse) RawJSON added in v0.4.0

func (r AgentSignUpResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentSignUpResponse) UnmarshalJSON added in v0.4.0

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

type AgentVerifyParams added in v0.2.0

type AgentVerifyParams struct {
	// 6-digit verification code sent to the human's email address.
	OtpCode string `json:"otp_code" api:"required"`
	// contains filtered or unexported fields
}

func (AgentVerifyParams) MarshalJSON added in v0.2.0

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

func (*AgentVerifyParams) UnmarshalJSON added in v0.2.0

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

type AgentVerifyResponse added in v0.2.0

type AgentVerifyResponse struct {
	// Whether the organization was verified.
	Verified bool `json:"verified" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Verified    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response after successful agent verification.

func (AgentVerifyResponse) RawJSON added in v0.2.0

func (r AgentVerifyResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentVerifyResponse) UnmarshalJSON added in v0.2.0

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

type AttachmentContentDisposition

type AttachmentContentDisposition string

Content disposition of attachment.

const (
	AttachmentContentDispositionInline     AttachmentContentDisposition = "inline"
	AttachmentContentDispositionAttachment AttachmentContentDisposition = "attachment"
)

type AttachmentFile

type AttachmentFile struct {
	// ID of attachment.
	AttachmentID string `json:"attachment_id" api:"required"`
	// Size of attachment in bytes.
	Size int64 `json:"size" api:"required"`
	// Content disposition of attachment.
	//
	// Any of "inline", "attachment".
	ContentDisposition AttachmentContentDisposition `json:"content_disposition" api:"nullable"`
	// Content ID of attachment.
	ContentID string `json:"content_id" api:"nullable"`
	// Content type of attachment.
	ContentType string `json:"content_type" api:"nullable"`
	// Filename of attachment.
	Filename string `json:"filename" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AttachmentID       respjson.Field
		Size               respjson.Field
		ContentDisposition respjson.Field
		ContentID          respjson.Field
		ContentType        respjson.Field
		Filename           respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AttachmentFile) RawJSON

func (r AttachmentFile) RawJSON() string

Returns the unmodified JSON received from the API

func (*AttachmentFile) UnmarshalJSON

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

type AttachmentResponse

type AttachmentResponse struct {
	// ID of attachment.
	AttachmentID string `json:"attachment_id" api:"required"`
	// URL to download the attachment.
	DownloadURL string `json:"download_url" api:"required"`
	// Time at which the download URL expires.
	ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"`
	// Size of attachment in bytes.
	Size int64 `json:"size" api:"required"`
	// Content disposition of attachment.
	//
	// Any of "inline", "attachment".
	ContentDisposition AttachmentContentDisposition `json:"content_disposition" api:"nullable"`
	// Content ID of attachment.
	ContentID string `json:"content_id" api:"nullable"`
	// Content type of attachment.
	ContentType string `json:"content_type" api:"nullable"`
	// Filename of attachment.
	Filename string `json:"filename" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AttachmentID       respjson.Field
		DownloadURL        respjson.Field
		ExpiresAt          respjson.Field
		Size               respjson.Field
		ContentDisposition respjson.Field
		ContentID          respjson.Field
		ContentType        respjson.Field
		Filename           respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AttachmentResponse) RawJSON

func (r AttachmentResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AttachmentResponse) UnmarshalJSON

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

type Client

type Client struct {
	Options       []option.RequestOption
	Agent         AgentService
	Inboxes       InboxService
	Pods          PodService
	Webhooks      WebhookService
	APIKeys       APIKeyService
	Domains       DomainService
	Drafts        DraftService
	Lists         ListService
	Metrics       MetricService
	Organizations OrganizationService
	Threads       ThreadService
}

Client creates a struct with services and top level methods that help with interacting with the agentmail 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 (AGENTMAIL_API_KEY, AGENTMAIL_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 CreateDomainParam

type CreateDomainParam struct {
	// The name of the domain (e.g., `example.com`).
	Domain string `json:"domain" api:"required"`
	// Bounce and complaint notifications are sent to your inboxes.
	FeedbackEnabled bool `json:"feedback_enabled" api:"required"`
	// contains filtered or unexported fields
}

The properties Domain, FeedbackEnabled are required.

func (CreateDomainParam) MarshalJSON

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

func (*CreateDomainParam) UnmarshalJSON

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

type CreateInboxParam

type CreateInboxParam struct {
	// Client ID of inbox.
	ClientID param.Opt[string] `json:"client_id,omitzero"`
	// Display name: `Display Name <username@domain.com>`.
	DisplayName param.Opt[string] `json:"display_name,omitzero"`
	// Domain of address. Must be verified domain. Defaults to `agentmail.to`.
	Domain param.Opt[string] `json:"domain,omitzero"`
	// Username of address. Randomly generated if not specified.
	Username param.Opt[string] `json:"username,omitzero"`
	// contains filtered or unexported fields
}

func (CreateInboxParam) MarshalJSON

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

func (*CreateInboxParam) UnmarshalJSON

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

type Domain

type Domain struct {
	// Time at which the domain was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// The name of the domain (e.g., `example.com`).
	Domain string `json:"domain" api:"required"`
	// The ID of the domain.
	DomainID string `json:"domain_id" api:"required"`
	// Bounce and complaint notifications are sent to your inboxes.
	FeedbackEnabled bool `json:"feedback_enabled" api:"required"`
	// A list of DNS records required to verify the domain.
	Records []DomainRecord `json:"records" api:"required"`
	// The verification status of the domain.
	//
	// Any of "NOT_STARTED", "PENDING", "INVALID", "FAILED", "VERIFYING", "VERIFIED".
	Status DomainStatus `json:"status" api:"required"`
	// Time at which the domain was last updated.
	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
	// Client ID of domain.
	ClientID string `json:"client_id" api:"nullable"`
	// ID of pod.
	PodID string `json:"pod_id" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt       respjson.Field
		Domain          respjson.Field
		DomainID        respjson.Field
		FeedbackEnabled respjson.Field
		Records         respjson.Field
		Status          respjson.Field
		UpdatedAt       respjson.Field
		ClientID        respjson.Field
		PodID           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Domain) RawJSON

func (r Domain) RawJSON() string

Returns the unmodified JSON received from the API

func (*Domain) UnmarshalJSON

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

type DomainListParams

type DomainListParams struct {
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (DomainListParams) URLQuery

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

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

type DomainNewParams

type DomainNewParams struct {
	CreateDomain CreateDomainParam
	// contains filtered or unexported fields
}

func (DomainNewParams) MarshalJSON

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

func (*DomainNewParams) UnmarshalJSON

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

type DomainRecord

type DomainRecord struct {
	// The name or host of the record.
	Name string `json:"name" api:"required"`
	// The verification status of this specific record.
	//
	// Any of "MISSING", "INVALID", "VALID".
	Status string `json:"status" api:"required"`
	// The type of the DNS record.
	//
	// Any of "TXT", "CNAME", "MX".
	Type string `json:"type" api:"required"`
	// The value of the record.
	Value string `json:"value" api:"required"`
	// The priority of the MX record.
	Priority int64 `json:"priority" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name        respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		Value       respjson.Field
		Priority    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (DomainRecord) RawJSON

func (r DomainRecord) RawJSON() string

Returns the unmodified JSON received from the API

func (*DomainRecord) UnmarshalJSON

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

type DomainService

type DomainService struct {
	Options []option.RequestOption
}

DomainService contains methods and other services that help with interacting with the agentmail 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 NewDomainService method instead.

func NewDomainService

func NewDomainService(opts ...option.RequestOption) (r DomainService)

NewDomainService 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 (*DomainService) Delete

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

**CLI:**

```bash agentmail domains delete --domain-id <domain_id> ```

func (*DomainService) Get

func (r *DomainService) Get(ctx context.Context, domainID string, opts ...option.RequestOption) (res *Domain, err error)

**CLI:**

```bash agentmail domains get --domain-id <domain_id> ```

func (*DomainService) GetZoneFile

func (r *DomainService) GetZoneFile(ctx context.Context, domainID string, opts ...option.RequestOption) (err error)

**CLI:**

```bash agentmail domains get-zone-file --domain-id <domain_id> ```

func (*DomainService) List

func (r *DomainService) List(ctx context.Context, query DomainListParams, opts ...option.RequestOption) (res *ListDomains, err error)

**CLI:**

```bash agentmail domains list ```

func (*DomainService) New

func (r *DomainService) New(ctx context.Context, body DomainNewParams, opts ...option.RequestOption) (res *Domain, err error)

**CLI:**

```bash agentmail domains create --domain example.com ```

func (*DomainService) Update added in v0.4.0

func (r *DomainService) Update(ctx context.Context, domainID string, body DomainUpdateParams, opts ...option.RequestOption) (res *Domain, err error)

**CLI:**

```bash agentmail domains update --domain-id <domain_id> ```

func (*DomainService) Verify

func (r *DomainService) Verify(ctx context.Context, domainID string, opts ...option.RequestOption) (err error)

**CLI:**

```bash agentmail domains verify --domain-id <domain_id> ```

type DomainStatus

type DomainStatus string

The verification status of the domain.

const (
	DomainStatusNotStarted DomainStatus = "NOT_STARTED"
	DomainStatusPending    DomainStatus = "PENDING"
	DomainStatusInvalid    DomainStatus = "INVALID"
	DomainStatusFailed     DomainStatus = "FAILED"
	DomainStatusVerifying  DomainStatus = "VERIFYING"
	DomainStatusVerified   DomainStatus = "VERIFIED"
)

type DomainUpdateParams added in v0.4.0

type DomainUpdateParams struct {
	// Bounce and complaint notifications are sent to your inboxes.
	FeedbackEnabled param.Opt[bool] `json:"feedback_enabled,omitzero"`
	// contains filtered or unexported fields
}

func (DomainUpdateParams) MarshalJSON added in v0.4.0

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

func (*DomainUpdateParams) UnmarshalJSON added in v0.4.0

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

type Draft

type Draft struct {
	// Time at which draft was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// ID of draft.
	DraftID string `json:"draft_id" api:"required"`
	// The ID of the inbox.
	InboxID string `json:"inbox_id" api:"required"`
	// Labels of draft.
	Labels []string `json:"labels" api:"required"`
	// Time at which draft was last updated.
	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
	// Attachments in draft.
	Attachments []AttachmentFile `json:"attachments" api:"nullable"`
	// Addresses of BCC recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Bcc []string `json:"bcc" api:"nullable"`
	// Addresses of CC recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Cc []string `json:"cc" api:"nullable"`
	// Client ID of draft.
	ClientID string `json:"client_id" api:"nullable"`
	// HTML body of draft.
	HTML string `json:"html" api:"nullable"`
	// ID of message being replied to.
	InReplyTo string `json:"in_reply_to" api:"nullable"`
	// Text preview of draft.
	Preview string `json:"preview" api:"nullable"`
	// IDs of previous messages in thread.
	References []string `json:"references" api:"nullable"`
	// Reply-to addresses. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	ReplyTo []string `json:"reply_to" api:"nullable"`
	// Time at which to schedule send draft.
	SendAt time.Time `json:"send_at" api:"nullable" format:"date-time"`
	// Schedule send status of draft.
	//
	// Any of "scheduled", "sending", "failed".
	SendStatus DraftSendStatus `json:"send_status" api:"nullable"`
	// Subject of draft.
	Subject string `json:"subject" api:"nullable"`
	// Plain text body of draft.
	Text string `json:"text" api:"nullable"`
	// Addresses of recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	To []string `json:"to" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		DraftID     respjson.Field
		InboxID     respjson.Field
		Labels      respjson.Field
		UpdatedAt   respjson.Field
		Attachments respjson.Field
		Bcc         respjson.Field
		Cc          respjson.Field
		ClientID    respjson.Field
		HTML        respjson.Field
		InReplyTo   respjson.Field
		Preview     respjson.Field
		References  respjson.Field
		ReplyTo     respjson.Field
		SendAt      respjson.Field
		SendStatus  respjson.Field
		Subject     respjson.Field
		Text        respjson.Field
		To          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Draft) RawJSON

func (r Draft) RawJSON() string

Returns the unmodified JSON received from the API

func (*Draft) UnmarshalJSON

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

type DraftGetAttachmentParams added in v0.4.0

type DraftGetAttachmentParams struct {
	// ID of draft.
	DraftID string `path:"draft_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type DraftListParams

type DraftListParams struct {
	// Timestamp after which to filter by.
	After param.Opt[time.Time] `query:"after,omitzero" format:"date-time" json:"-"`
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Timestamp before which to filter by.
	Before param.Opt[time.Time] `query:"before,omitzero" format:"date-time" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// Labels to filter by.
	Labels []string `query:"labels,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (DraftListParams) URLQuery

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

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

type DraftSendStatus

type DraftSendStatus string

Schedule send status of draft.

const (
	DraftSendStatusScheduled DraftSendStatus = "scheduled"
	DraftSendStatusSending   DraftSendStatus = "sending"
	DraftSendStatusFailed    DraftSendStatus = "failed"
)

type DraftService

type DraftService struct {
	Options []option.RequestOption
}

DraftService contains methods and other services that help with interacting with the agentmail 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 NewDraftService method instead.

func NewDraftService

func NewDraftService(opts ...option.RequestOption) (r DraftService)

NewDraftService 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 (*DraftService) Get

func (r *DraftService) Get(ctx context.Context, draftID string, opts ...option.RequestOption) (res *Draft, err error)

**CLI:**

```bash agentmail drafts get --draft-id <draft_id> ```

func (*DraftService) GetAttachment added in v0.4.0

func (r *DraftService) GetAttachment(ctx context.Context, attachmentID string, query DraftGetAttachmentParams, opts ...option.RequestOption) (res *AttachmentResponse, err error)

**CLI:**

```bash agentmail drafts get-attachment --draft-id <draft_id> --attachment-id <attachment_id> ```

func (*DraftService) List

func (r *DraftService) List(ctx context.Context, query DraftListParams, opts ...option.RequestOption) (res *ListDrafts, err error)

**CLI:**

```bash agentmail drafts list ```

type Error

type Error = apierror.Error

type EventType

type EventType string
const (
	EventTypeMessageReceived                EventType = "message.received"
	EventTypeMessageReceivedSpam            EventType = "message.received.spam"
	EventTypeMessageReceivedBlocked         EventType = "message.received.blocked"
	EventTypeMessageReceivedUnauthenticated EventType = "message.received.unauthenticated"
	EventTypeMessageSent                    EventType = "message.sent"
	EventTypeMessageDelivered               EventType = "message.delivered"
	EventTypeMessageBounced                 EventType = "message.bounced"
	EventTypeMessageComplained              EventType = "message.complained"
	EventTypeMessageRejected                EventType = "message.rejected"
	EventTypeDomainVerified                 EventType = "domain.verified"
)

type Inbox

type Inbox struct {
	// Time at which inbox was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Email address of the inbox.
	Email string `json:"email" api:"required"`
	// The ID of the inbox.
	InboxID string `json:"inbox_id" api:"required"`
	// ID of pod.
	PodID string `json:"pod_id" api:"required"`
	// Time at which inbox was last updated.
	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
	// Client ID of inbox.
	ClientID string `json:"client_id" api:"nullable"`
	// Display name: `Display Name <username@domain.com>`.
	DisplayName string `json:"display_name" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Email       respjson.Field
		InboxID     respjson.Field
		PodID       respjson.Field
		UpdatedAt   respjson.Field
		ClientID    respjson.Field
		DisplayName respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Inbox) RawJSON

func (r Inbox) RawJSON() string

Returns the unmodified JSON received from the API

func (*Inbox) UnmarshalJSON

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

type InboxAPIKeyDeleteParams added in v0.4.0

type InboxAPIKeyDeleteParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type InboxAPIKeyListParams added in v0.4.0

type InboxAPIKeyListParams struct {
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (InboxAPIKeyListParams) URLQuery added in v0.4.0

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

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

type InboxAPIKeyListResponse added in v0.4.0

type InboxAPIKeyListResponse struct {
	// Ordered by `created_at` descending.
	APIKeys []InboxAPIKeyListResponseAPIKey `json:"api_keys" api:"required"`
	// Number of items returned.
	Count int64 `json:"count" api:"required"`
	// Page token for pagination.
	NextPageToken string `json:"next_page_token" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKeys       respjson.Field
		Count         respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxAPIKeyListResponse) RawJSON added in v0.4.0

func (r InboxAPIKeyListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InboxAPIKeyListResponse) UnmarshalJSON added in v0.4.0

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

type InboxAPIKeyListResponseAPIKey added in v0.4.0

type InboxAPIKeyListResponseAPIKey struct {
	// ID of api key.
	APIKeyID string `json:"api_key_id" api:"required"`
	// Time at which api key was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Name of api key.
	Name string `json:"name" api:"required"`
	// Prefix of api key.
	Prefix string `json:"prefix" api:"required"`
	// Inbox ID the api key is scoped to. If set, the key can only access resources
	// within this inbox.
	InboxID string `json:"inbox_id" api:"nullable"`
	// Granular permissions for the API key. When ommitted all permissions are granted.
	// Otherwise, only permissions set to true are granted.
	Permissions InboxAPIKeyListResponseAPIKeyPermissions `json:"permissions" api:"nullable"`
	// Pod ID the api key is scoped to. If set, the key can only access resources
	// within this pod.
	PodID string `json:"pod_id" api:"nullable"`
	// Time at which api key was last used.
	UsedAt time.Time `json:"used_at" api:"nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKeyID    respjson.Field
		CreatedAt   respjson.Field
		Name        respjson.Field
		Prefix      respjson.Field
		InboxID     respjson.Field
		Permissions respjson.Field
		PodID       respjson.Field
		UsedAt      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxAPIKeyListResponseAPIKey) RawJSON added in v0.4.0

Returns the unmodified JSON received from the API

func (*InboxAPIKeyListResponseAPIKey) UnmarshalJSON added in v0.4.0

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

type InboxAPIKeyListResponseAPIKeyPermissions added in v0.4.0

type InboxAPIKeyListResponseAPIKeyPermissions struct {
	// Create API keys.
	APIKeyCreate bool `json:"api_key_create" api:"nullable"`
	// Delete API keys.
	APIKeyDelete bool `json:"api_key_delete" api:"nullable"`
	// Read API keys.
	APIKeyRead bool `json:"api_key_read" api:"nullable"`
	// Create domains.
	DomainCreate bool `json:"domain_create" api:"nullable"`
	// Delete domains.
	DomainDelete bool `json:"domain_delete" api:"nullable"`
	// Read domain details.
	DomainRead bool `json:"domain_read" api:"nullable"`
	// Update domains.
	DomainUpdate bool `json:"domain_update" api:"nullable"`
	// Create drafts.
	DraftCreate bool `json:"draft_create" api:"nullable"`
	// Delete drafts.
	DraftDelete bool `json:"draft_delete" api:"nullable"`
	// Read drafts.
	DraftRead bool `json:"draft_read" api:"nullable"`
	// Send drafts.
	DraftSend bool `json:"draft_send" api:"nullable"`
	// Update drafts.
	DraftUpdate bool `json:"draft_update" api:"nullable"`
	// Create new inboxes.
	InboxCreate bool `json:"inbox_create" api:"nullable"`
	// Delete inboxes.
	InboxDelete bool `json:"inbox_delete" api:"nullable"`
	// Read inbox details.
	InboxRead bool `json:"inbox_read" api:"nullable"`
	// Update inbox settings.
	InboxUpdate bool `json:"inbox_update" api:"nullable"`
	// Access messages labeled blocked.
	LabelBlockedRead bool `json:"label_blocked_read" api:"nullable"`
	// Access messages labeled spam.
	LabelSpamRead bool `json:"label_spam_read" api:"nullable"`
	// Access messages labeled trash.
	LabelTrashRead bool `json:"label_trash_read" api:"nullable"`
	// Create list entries.
	ListEntryCreate bool `json:"list_entry_create" api:"nullable"`
	// Delete list entries.
	ListEntryDelete bool `json:"list_entry_delete" api:"nullable"`
	// Read list entries.
	ListEntryRead bool `json:"list_entry_read" api:"nullable"`
	// Read messages.
	MessageRead bool `json:"message_read" api:"nullable"`
	// Send messages.
	MessageSend bool `json:"message_send" api:"nullable"`
	// Update message labels.
	MessageUpdate bool `json:"message_update" api:"nullable"`
	// Read metrics.
	MetricsRead bool `json:"metrics_read" api:"nullable"`
	// Create pods.
	PodCreate bool `json:"pod_create" api:"nullable"`
	// Delete pods.
	PodDelete bool `json:"pod_delete" api:"nullable"`
	// Read pods.
	PodRead bool `json:"pod_read" api:"nullable"`
	// Delete threads.
	ThreadDelete bool `json:"thread_delete" api:"nullable"`
	// Read threads.
	ThreadRead bool `json:"thread_read" api:"nullable"`
	// Create webhooks.
	WebhookCreate bool `json:"webhook_create" api:"nullable"`
	// Delete webhooks.
	WebhookDelete bool `json:"webhook_delete" api:"nullable"`
	// Read webhook configurations.
	WebhookRead bool `json:"webhook_read" api:"nullable"`
	// Update webhooks.
	WebhookUpdate bool `json:"webhook_update" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKeyCreate     respjson.Field
		APIKeyDelete     respjson.Field
		APIKeyRead       respjson.Field
		DomainCreate     respjson.Field
		DomainDelete     respjson.Field
		DomainRead       respjson.Field
		DomainUpdate     respjson.Field
		DraftCreate      respjson.Field
		DraftDelete      respjson.Field
		DraftRead        respjson.Field
		DraftSend        respjson.Field
		DraftUpdate      respjson.Field
		InboxCreate      respjson.Field
		InboxDelete      respjson.Field
		InboxRead        respjson.Field
		InboxUpdate      respjson.Field
		LabelBlockedRead respjson.Field
		LabelSpamRead    respjson.Field
		LabelTrashRead   respjson.Field
		ListEntryCreate  respjson.Field
		ListEntryDelete  respjson.Field
		ListEntryRead    respjson.Field
		MessageRead      respjson.Field
		MessageSend      respjson.Field
		MessageUpdate    respjson.Field
		MetricsRead      respjson.Field
		PodCreate        respjson.Field
		PodDelete        respjson.Field
		PodRead          respjson.Field
		ThreadDelete     respjson.Field
		ThreadRead       respjson.Field
		WebhookCreate    respjson.Field
		WebhookDelete    respjson.Field
		WebhookRead      respjson.Field
		WebhookUpdate    respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Granular permissions for the API key. When ommitted all permissions are granted. Otherwise, only permissions set to true are granted.

func (InboxAPIKeyListResponseAPIKeyPermissions) RawJSON added in v0.4.0

Returns the unmodified JSON received from the API

func (*InboxAPIKeyListResponseAPIKeyPermissions) UnmarshalJSON added in v0.4.0

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

type InboxAPIKeyNewParams added in v0.4.0

type InboxAPIKeyNewParams struct {
	// Name of api key.
	Name param.Opt[string] `json:"name,omitzero"`
	// Granular permissions for the API key. When ommitted all permissions are granted.
	// Otherwise, only permissions set to true are granted.
	Permissions InboxAPIKeyNewParamsPermissions `json:"permissions,omitzero"`
	// contains filtered or unexported fields
}

func (InboxAPIKeyNewParams) MarshalJSON added in v0.4.0

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

func (*InboxAPIKeyNewParams) UnmarshalJSON added in v0.4.0

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

type InboxAPIKeyNewParamsPermissions added in v0.4.0

type InboxAPIKeyNewParamsPermissions struct {
	// Create API keys.
	APIKeyCreate param.Opt[bool] `json:"api_key_create,omitzero"`
	// Delete API keys.
	APIKeyDelete param.Opt[bool] `json:"api_key_delete,omitzero"`
	// Read API keys.
	APIKeyRead param.Opt[bool] `json:"api_key_read,omitzero"`
	// Create domains.
	DomainCreate param.Opt[bool] `json:"domain_create,omitzero"`
	// Delete domains.
	DomainDelete param.Opt[bool] `json:"domain_delete,omitzero"`
	// Read domain details.
	DomainRead param.Opt[bool] `json:"domain_read,omitzero"`
	// Update domains.
	DomainUpdate param.Opt[bool] `json:"domain_update,omitzero"`
	// Create drafts.
	DraftCreate param.Opt[bool] `json:"draft_create,omitzero"`
	// Delete drafts.
	DraftDelete param.Opt[bool] `json:"draft_delete,omitzero"`
	// Read drafts.
	DraftRead param.Opt[bool] `json:"draft_read,omitzero"`
	// Send drafts.
	DraftSend param.Opt[bool] `json:"draft_send,omitzero"`
	// Update drafts.
	DraftUpdate param.Opt[bool] `json:"draft_update,omitzero"`
	// Create new inboxes.
	InboxCreate param.Opt[bool] `json:"inbox_create,omitzero"`
	// Delete inboxes.
	InboxDelete param.Opt[bool] `json:"inbox_delete,omitzero"`
	// Read inbox details.
	InboxRead param.Opt[bool] `json:"inbox_read,omitzero"`
	// Update inbox settings.
	InboxUpdate param.Opt[bool] `json:"inbox_update,omitzero"`
	// Access messages labeled blocked.
	LabelBlockedRead param.Opt[bool] `json:"label_blocked_read,omitzero"`
	// Access messages labeled spam.
	LabelSpamRead param.Opt[bool] `json:"label_spam_read,omitzero"`
	// Access messages labeled trash.
	LabelTrashRead param.Opt[bool] `json:"label_trash_read,omitzero"`
	// Create list entries.
	ListEntryCreate param.Opt[bool] `json:"list_entry_create,omitzero"`
	// Delete list entries.
	ListEntryDelete param.Opt[bool] `json:"list_entry_delete,omitzero"`
	// Read list entries.
	ListEntryRead param.Opt[bool] `json:"list_entry_read,omitzero"`
	// Read messages.
	MessageRead param.Opt[bool] `json:"message_read,omitzero"`
	// Send messages.
	MessageSend param.Opt[bool] `json:"message_send,omitzero"`
	// Update message labels.
	MessageUpdate param.Opt[bool] `json:"message_update,omitzero"`
	// Read metrics.
	MetricsRead param.Opt[bool] `json:"metrics_read,omitzero"`
	// Create pods.
	PodCreate param.Opt[bool] `json:"pod_create,omitzero"`
	// Delete pods.
	PodDelete param.Opt[bool] `json:"pod_delete,omitzero"`
	// Read pods.
	PodRead param.Opt[bool] `json:"pod_read,omitzero"`
	// Delete threads.
	ThreadDelete param.Opt[bool] `json:"thread_delete,omitzero"`
	// Read threads.
	ThreadRead param.Opt[bool] `json:"thread_read,omitzero"`
	// Create webhooks.
	WebhookCreate param.Opt[bool] `json:"webhook_create,omitzero"`
	// Delete webhooks.
	WebhookDelete param.Opt[bool] `json:"webhook_delete,omitzero"`
	// Read webhook configurations.
	WebhookRead param.Opt[bool] `json:"webhook_read,omitzero"`
	// Update webhooks.
	WebhookUpdate param.Opt[bool] `json:"webhook_update,omitzero"`
	// contains filtered or unexported fields
}

Granular permissions for the API key. When ommitted all permissions are granted. Otherwise, only permissions set to true are granted.

func (InboxAPIKeyNewParamsPermissions) MarshalJSON added in v0.4.0

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

func (*InboxAPIKeyNewParamsPermissions) UnmarshalJSON added in v0.4.0

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

type InboxAPIKeyNewResponse added in v0.4.0

type InboxAPIKeyNewResponse struct {
	// API key.
	APIKey string `json:"api_key" api:"required"`
	// ID of api key.
	APIKeyID string `json:"api_key_id" api:"required"`
	// Time at which api key was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Name of api key.
	Name string `json:"name" api:"required"`
	// Prefix of api key.
	Prefix string `json:"prefix" api:"required"`
	// Inbox ID the api key is scoped to.
	InboxID string `json:"inbox_id" api:"nullable"`
	// Granular permissions for the API key. When ommitted all permissions are granted.
	// Otherwise, only permissions set to true are granted.
	Permissions InboxAPIKeyNewResponsePermissions `json:"permissions" api:"nullable"`
	// Pod ID the api key is scoped to.
	PodID string `json:"pod_id" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKey      respjson.Field
		APIKeyID    respjson.Field
		CreatedAt   respjson.Field
		Name        respjson.Field
		Prefix      respjson.Field
		InboxID     respjson.Field
		Permissions respjson.Field
		PodID       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxAPIKeyNewResponse) RawJSON added in v0.4.0

func (r InboxAPIKeyNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InboxAPIKeyNewResponse) UnmarshalJSON added in v0.4.0

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

type InboxAPIKeyNewResponsePermissions added in v0.4.0

type InboxAPIKeyNewResponsePermissions struct {
	// Create API keys.
	APIKeyCreate bool `json:"api_key_create" api:"nullable"`
	// Delete API keys.
	APIKeyDelete bool `json:"api_key_delete" api:"nullable"`
	// Read API keys.
	APIKeyRead bool `json:"api_key_read" api:"nullable"`
	// Create domains.
	DomainCreate bool `json:"domain_create" api:"nullable"`
	// Delete domains.
	DomainDelete bool `json:"domain_delete" api:"nullable"`
	// Read domain details.
	DomainRead bool `json:"domain_read" api:"nullable"`
	// Update domains.
	DomainUpdate bool `json:"domain_update" api:"nullable"`
	// Create drafts.
	DraftCreate bool `json:"draft_create" api:"nullable"`
	// Delete drafts.
	DraftDelete bool `json:"draft_delete" api:"nullable"`
	// Read drafts.
	DraftRead bool `json:"draft_read" api:"nullable"`
	// Send drafts.
	DraftSend bool `json:"draft_send" api:"nullable"`
	// Update drafts.
	DraftUpdate bool `json:"draft_update" api:"nullable"`
	// Create new inboxes.
	InboxCreate bool `json:"inbox_create" api:"nullable"`
	// Delete inboxes.
	InboxDelete bool `json:"inbox_delete" api:"nullable"`
	// Read inbox details.
	InboxRead bool `json:"inbox_read" api:"nullable"`
	// Update inbox settings.
	InboxUpdate bool `json:"inbox_update" api:"nullable"`
	// Access messages labeled blocked.
	LabelBlockedRead bool `json:"label_blocked_read" api:"nullable"`
	// Access messages labeled spam.
	LabelSpamRead bool `json:"label_spam_read" api:"nullable"`
	// Access messages labeled trash.
	LabelTrashRead bool `json:"label_trash_read" api:"nullable"`
	// Create list entries.
	ListEntryCreate bool `json:"list_entry_create" api:"nullable"`
	// Delete list entries.
	ListEntryDelete bool `json:"list_entry_delete" api:"nullable"`
	// Read list entries.
	ListEntryRead bool `json:"list_entry_read" api:"nullable"`
	// Read messages.
	MessageRead bool `json:"message_read" api:"nullable"`
	// Send messages.
	MessageSend bool `json:"message_send" api:"nullable"`
	// Update message labels.
	MessageUpdate bool `json:"message_update" api:"nullable"`
	// Read metrics.
	MetricsRead bool `json:"metrics_read" api:"nullable"`
	// Create pods.
	PodCreate bool `json:"pod_create" api:"nullable"`
	// Delete pods.
	PodDelete bool `json:"pod_delete" api:"nullable"`
	// Read pods.
	PodRead bool `json:"pod_read" api:"nullable"`
	// Delete threads.
	ThreadDelete bool `json:"thread_delete" api:"nullable"`
	// Read threads.
	ThreadRead bool `json:"thread_read" api:"nullable"`
	// Create webhooks.
	WebhookCreate bool `json:"webhook_create" api:"nullable"`
	// Delete webhooks.
	WebhookDelete bool `json:"webhook_delete" api:"nullable"`
	// Read webhook configurations.
	WebhookRead bool `json:"webhook_read" api:"nullable"`
	// Update webhooks.
	WebhookUpdate bool `json:"webhook_update" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKeyCreate     respjson.Field
		APIKeyDelete     respjson.Field
		APIKeyRead       respjson.Field
		DomainCreate     respjson.Field
		DomainDelete     respjson.Field
		DomainRead       respjson.Field
		DomainUpdate     respjson.Field
		DraftCreate      respjson.Field
		DraftDelete      respjson.Field
		DraftRead        respjson.Field
		DraftSend        respjson.Field
		DraftUpdate      respjson.Field
		InboxCreate      respjson.Field
		InboxDelete      respjson.Field
		InboxRead        respjson.Field
		InboxUpdate      respjson.Field
		LabelBlockedRead respjson.Field
		LabelSpamRead    respjson.Field
		LabelTrashRead   respjson.Field
		ListEntryCreate  respjson.Field
		ListEntryDelete  respjson.Field
		ListEntryRead    respjson.Field
		MessageRead      respjson.Field
		MessageSend      respjson.Field
		MessageUpdate    respjson.Field
		MetricsRead      respjson.Field
		PodCreate        respjson.Field
		PodDelete        respjson.Field
		PodRead          respjson.Field
		ThreadDelete     respjson.Field
		ThreadRead       respjson.Field
		WebhookCreate    respjson.Field
		WebhookDelete    respjson.Field
		WebhookRead      respjson.Field
		WebhookUpdate    respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Granular permissions for the API key. When ommitted all permissions are granted. Otherwise, only permissions set to true are granted.

func (InboxAPIKeyNewResponsePermissions) RawJSON added in v0.4.0

Returns the unmodified JSON received from the API

func (*InboxAPIKeyNewResponsePermissions) UnmarshalJSON added in v0.4.0

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

type InboxAPIKeyService added in v0.4.0

type InboxAPIKeyService struct {
	Options []option.RequestOption
}

InboxAPIKeyService contains methods and other services that help with interacting with the agentmail 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 NewInboxAPIKeyService method instead.

func NewInboxAPIKeyService added in v0.4.0

func NewInboxAPIKeyService(opts ...option.RequestOption) (r InboxAPIKeyService)

NewInboxAPIKeyService 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 (*InboxAPIKeyService) Delete added in v0.4.0

func (r *InboxAPIKeyService) Delete(ctx context.Context, apiKeyID string, body InboxAPIKeyDeleteParams, opts ...option.RequestOption) (err error)

**CLI:**

```bash agentmail inboxes:api-keys delete --inbox-id <inbox_id> --api-key-id <api_key_id> ```

func (*InboxAPIKeyService) List added in v0.4.0

**CLI:**

```bash agentmail inboxes:api-keys list --inbox-id <inbox_id> ```

func (*InboxAPIKeyService) New added in v0.4.0

**CLI:**

```bash agentmail inboxes:api-keys create --inbox-id <inbox_id> --name "My Key" ```

type InboxDraftDeleteParams

type InboxDraftDeleteParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type InboxDraftGetAttachmentParams added in v0.4.0

type InboxDraftGetAttachmentParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// ID of draft.
	DraftID string `path:"draft_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type InboxDraftGetParams

type InboxDraftGetParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type InboxDraftListParams

type InboxDraftListParams struct {
	// Timestamp after which to filter by.
	After param.Opt[time.Time] `query:"after,omitzero" format:"date-time" json:"-"`
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Timestamp before which to filter by.
	Before param.Opt[time.Time] `query:"before,omitzero" format:"date-time" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// Labels to filter by.
	Labels []string `query:"labels,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (InboxDraftListParams) URLQuery

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

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

type InboxDraftNewParams

type InboxDraftNewParams struct {
	// Client ID of draft.
	ClientID param.Opt[string] `json:"client_id,omitzero"`
	// HTML body of draft.
	HTML param.Opt[string] `json:"html,omitzero"`
	// ID of message being replied to.
	InReplyTo param.Opt[string] `json:"in_reply_to,omitzero"`
	// Time at which to schedule send draft.
	SendAt param.Opt[time.Time] `json:"send_at,omitzero" format:"date-time"`
	// Subject of draft.
	Subject param.Opt[string] `json:"subject,omitzero"`
	// Plain text body of draft.
	Text param.Opt[string] `json:"text,omitzero"`
	// Attachments to include in draft.
	Attachments []SendAttachmentParam `json:"attachments,omitzero"`
	// Addresses of BCC recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Bcc []string `json:"bcc,omitzero"`
	// Addresses of CC recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Cc []string `json:"cc,omitzero"`
	// Labels of draft.
	Labels []string `json:"labels,omitzero"`
	// Reply-to addresses. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	ReplyTo []string `json:"reply_to,omitzero"`
	// Addresses of recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	To []string `json:"to,omitzero"`
	// contains filtered or unexported fields
}

func (InboxDraftNewParams) MarshalJSON

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

func (*InboxDraftNewParams) UnmarshalJSON

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

type InboxDraftSendParams

type InboxDraftSendParams struct {
	// The ID of the inbox.
	InboxID       string `path:"inbox_id" api:"required" json:"-"`
	UpdateMessage UpdateMessageParam
	// contains filtered or unexported fields
}

func (InboxDraftSendParams) MarshalJSON

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

func (*InboxDraftSendParams) UnmarshalJSON

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

type InboxDraftService

type InboxDraftService struct {
	Options []option.RequestOption
}

InboxDraftService contains methods and other services that help with interacting with the agentmail 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 NewInboxDraftService method instead.

func NewInboxDraftService

func NewInboxDraftService(opts ...option.RequestOption) (r InboxDraftService)

NewInboxDraftService 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 (*InboxDraftService) Delete

func (r *InboxDraftService) Delete(ctx context.Context, draftID string, body InboxDraftDeleteParams, opts ...option.RequestOption) (err error)

**CLI:**

```bash agentmail inboxes:drafts delete --inbox-id <inbox_id> --draft-id <draft_id> ```

func (*InboxDraftService) Get

func (r *InboxDraftService) Get(ctx context.Context, draftID string, query InboxDraftGetParams, opts ...option.RequestOption) (res *Draft, err error)

**CLI:**

```bash agentmail inboxes:drafts get --inbox-id <inbox_id> --draft-id <draft_id> ```

func (*InboxDraftService) GetAttachment added in v0.4.0

func (r *InboxDraftService) GetAttachment(ctx context.Context, attachmentID string, query InboxDraftGetAttachmentParams, opts ...option.RequestOption) (res *AttachmentResponse, err error)

**CLI:**

```bash agentmail inboxes:drafts get-attachment --inbox-id <inbox_id> --draft-id <draft_id> --attachment-id <attachment_id> ```

func (*InboxDraftService) List

func (r *InboxDraftService) List(ctx context.Context, inboxID string, query InboxDraftListParams, opts ...option.RequestOption) (res *ListDrafts, err error)

**CLI:**

```bash agentmail inboxes:drafts list --inbox-id <inbox_id> ```

func (*InboxDraftService) New

func (r *InboxDraftService) New(ctx context.Context, inboxID string, body InboxDraftNewParams, opts ...option.RequestOption) (res *Draft, err error)

**CLI:**

```bash agentmail inboxes:drafts create --inbox-id <inbox_id> --to recipient@example.com --subject "Draft subject" --text "Draft body" ```

func (*InboxDraftService) Send

func (r *InboxDraftService) Send(ctx context.Context, draftID string, params InboxDraftSendParams, opts ...option.RequestOption) (res *SendMessageResponse, err error)

**CLI:**

```bash agentmail inboxes:drafts send --inbox-id <inbox_id> --draft-id <draft_id> ```

func (*InboxDraftService) Update

func (r *InboxDraftService) Update(ctx context.Context, draftID string, params InboxDraftUpdateParams, opts ...option.RequestOption) (res *Draft, err error)

**CLI:**

```bash agentmail inboxes:drafts update --inbox-id <inbox_id> --draft-id <draft_id> --subject "Updated subject" ```

type InboxDraftUpdateParams

type InboxDraftUpdateParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// HTML body of draft.
	HTML param.Opt[string] `json:"html,omitzero"`
	// Time at which to schedule send draft.
	SendAt param.Opt[time.Time] `json:"send_at,omitzero" format:"date-time"`
	// Subject of draft.
	Subject param.Opt[string] `json:"subject,omitzero"`
	// Plain text body of draft.
	Text param.Opt[string] `json:"text,omitzero"`
	// Addresses of BCC recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Bcc []string `json:"bcc,omitzero"`
	// Addresses of CC recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Cc []string `json:"cc,omitzero"`
	// Reply-to addresses. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	ReplyTo []string `json:"reply_to,omitzero"`
	// Addresses of recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	To []string `json:"to,omitzero"`
	// contains filtered or unexported fields
}

func (InboxDraftUpdateParams) MarshalJSON

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

func (*InboxDraftUpdateParams) UnmarshalJSON

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

type InboxListDeleteParams added in v0.4.0

type InboxListDeleteParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction InboxListDeleteParamsDirection `path:"direction,omitzero" api:"required" json:"-"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	Type InboxListDeleteParamsType `path:"type,omitzero" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type InboxListDeleteParamsDirection added in v0.4.0

type InboxListDeleteParamsDirection string

Direction of list entry.

const (
	InboxListDeleteParamsDirectionSend    InboxListDeleteParamsDirection = "send"
	InboxListDeleteParamsDirectionReceive InboxListDeleteParamsDirection = "receive"
	InboxListDeleteParamsDirectionReply   InboxListDeleteParamsDirection = "reply"
)

type InboxListDeleteParamsType added in v0.4.0

type InboxListDeleteParamsType string

Type of list entry.

const (
	InboxListDeleteParamsTypeAllow InboxListDeleteParamsType = "allow"
	InboxListDeleteParamsTypeBlock InboxListDeleteParamsType = "block"
)

type InboxListGetParams added in v0.4.0

type InboxListGetParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction InboxListGetParamsDirection `path:"direction,omitzero" api:"required" json:"-"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	Type InboxListGetParamsType `path:"type,omitzero" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type InboxListGetParamsDirection added in v0.4.0

type InboxListGetParamsDirection string

Direction of list entry.

const (
	InboxListGetParamsDirectionSend    InboxListGetParamsDirection = "send"
	InboxListGetParamsDirectionReceive InboxListGetParamsDirection = "receive"
	InboxListGetParamsDirectionReply   InboxListGetParamsDirection = "reply"
)

type InboxListGetParamsType added in v0.4.0

type InboxListGetParamsType string

Type of list entry.

const (
	InboxListGetParamsTypeAllow InboxListGetParamsType = "allow"
	InboxListGetParamsTypeBlock InboxListGetParamsType = "block"
)

type InboxListGetResponse added in v0.4.0

type InboxListGetResponse struct {
	// Time at which entry was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction InboxListGetResponseDirection `json:"direction" api:"required"`
	// Email address or domain of list entry.
	Entry string `json:"entry" api:"required"`
	// Whether the entry is an email address or domain.
	//
	// Any of "email", "domain".
	EntryType InboxListGetResponseEntryType `json:"entry_type" api:"required"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	ListType InboxListGetResponseListType `json:"list_type" api:"required"`
	// ID of organization.
	OrganizationID string `json:"organization_id" api:"required"`
	// ID of pod.
	PodID string `json:"pod_id" api:"required"`
	// ID of inbox, if entry is inbox-scoped.
	InboxID string `json:"inbox_id" api:"nullable"`
	// Reason for adding the entry.
	Reason string `json:"reason" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt      respjson.Field
		Direction      respjson.Field
		Entry          respjson.Field
		EntryType      respjson.Field
		ListType       respjson.Field
		OrganizationID respjson.Field
		PodID          respjson.Field
		InboxID        respjson.Field
		Reason         respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxListGetResponse) RawJSON added in v0.4.0

func (r InboxListGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InboxListGetResponse) UnmarshalJSON added in v0.4.0

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

type InboxListGetResponseDirection added in v0.4.0

type InboxListGetResponseDirection string

Direction of list entry.

const (
	InboxListGetResponseDirectionSend    InboxListGetResponseDirection = "send"
	InboxListGetResponseDirectionReceive InboxListGetResponseDirection = "receive"
	InboxListGetResponseDirectionReply   InboxListGetResponseDirection = "reply"
)

type InboxListGetResponseEntryType added in v0.4.0

type InboxListGetResponseEntryType string

Whether the entry is an email address or domain.

const (
	InboxListGetResponseEntryTypeEmail  InboxListGetResponseEntryType = "email"
	InboxListGetResponseEntryTypeDomain InboxListGetResponseEntryType = "domain"
)

type InboxListGetResponseListType added in v0.4.0

type InboxListGetResponseListType string

Type of list entry.

const (
	InboxListGetResponseListTypeAllow InboxListGetResponseListType = "allow"
	InboxListGetResponseListTypeBlock InboxListGetResponseListType = "block"
)

type InboxListListParams added in v0.4.0

type InboxListListParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction InboxListListParamsDirection `path:"direction,omitzero" api:"required" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (InboxListListParams) URLQuery added in v0.4.0

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

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

type InboxListListParamsDirection added in v0.4.0

type InboxListListParamsDirection string

Direction of list entry.

const (
	InboxListListParamsDirectionSend    InboxListListParamsDirection = "send"
	InboxListListParamsDirectionReceive InboxListListParamsDirection = "receive"
	InboxListListParamsDirectionReply   InboxListListParamsDirection = "reply"
)

type InboxListListParamsType added in v0.4.0

type InboxListListParamsType string

Type of list entry.

const (
	InboxListListParamsTypeAllow InboxListListParamsType = "allow"
	InboxListListParamsTypeBlock InboxListListParamsType = "block"
)

type InboxListListResponse added in v0.4.0

type InboxListListResponse struct {
	// Number of items returned.
	Count int64 `json:"count" api:"required"`
	// Ordered by entry ascending.
	Entries []InboxListListResponseEntry `json:"entries" api:"required"`
	// Limit of number of items returned.
	Limit int64 `json:"limit" api:"nullable"`
	// Page token for pagination.
	NextPageToken string `json:"next_page_token" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count         respjson.Field
		Entries       respjson.Field
		Limit         respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxListListResponse) RawJSON added in v0.4.0

func (r InboxListListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InboxListListResponse) UnmarshalJSON added in v0.4.0

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

type InboxListListResponseEntry added in v0.4.0

type InboxListListResponseEntry struct {
	// Time at which entry was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction string `json:"direction" api:"required"`
	// Email address or domain of list entry.
	Entry string `json:"entry" api:"required"`
	// Whether the entry is an email address or domain.
	//
	// Any of "email", "domain".
	EntryType string `json:"entry_type" api:"required"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	ListType string `json:"list_type" api:"required"`
	// ID of organization.
	OrganizationID string `json:"organization_id" api:"required"`
	// ID of pod.
	PodID string `json:"pod_id" api:"required"`
	// ID of inbox, if entry is inbox-scoped.
	InboxID string `json:"inbox_id" api:"nullable"`
	// Reason for adding the entry.
	Reason string `json:"reason" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt      respjson.Field
		Direction      respjson.Field
		Entry          respjson.Field
		EntryType      respjson.Field
		ListType       respjson.Field
		OrganizationID respjson.Field
		PodID          respjson.Field
		InboxID        respjson.Field
		Reason         respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxListListResponseEntry) RawJSON added in v0.4.0

func (r InboxListListResponseEntry) RawJSON() string

Returns the unmodified JSON received from the API

func (*InboxListListResponseEntry) UnmarshalJSON added in v0.4.0

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

type InboxListMetricsParams

type InboxListMetricsParams struct {
	// Sort in descending order.
	Descending param.Opt[bool] `query:"descending,omitzero" json:"-"`
	// End timestamp for the query.
	End param.Opt[time.Time] `query:"end,omitzero" format:"date-time" json:"-"`
	// Limit on number of buckets to return.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Period in number of seconds for the query.
	Period param.Opt[string] `query:"period,omitzero" json:"-"`
	// Start timestamp for the query.
	Start param.Opt[time.Time] `query:"start,omitzero" format:"date-time" json:"-"`
	// List of metric event types to query.
	EventTypes []MetricEventType `query:"event_types,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (InboxListMetricsParams) URLQuery

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

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

type InboxListMetricsResponse added in v0.2.0

type InboxListMetricsResponse map[string][]InboxListMetricsResponseItem

type InboxListMetricsResponseItem added in v0.2.0

type InboxListMetricsResponseItem struct {
	// Count of events in the bucket.
	Count int64 `json:"count" api:"required"`
	// Timestamp of the bucket.
	Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Timestamp   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxListMetricsResponseItem) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*InboxListMetricsResponseItem) UnmarshalJSON added in v0.2.0

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

type InboxListNewParams added in v0.4.0

type InboxListNewParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction InboxListNewParamsDirection `path:"direction,omitzero" api:"required" json:"-"`
	// Email address or domain to add.
	Entry string `json:"entry" api:"required"`
	// Reason for adding the entry.
	Reason param.Opt[string] `json:"reason,omitzero"`
	// contains filtered or unexported fields
}

func (InboxListNewParams) MarshalJSON added in v0.4.0

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

func (*InboxListNewParams) UnmarshalJSON added in v0.4.0

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

type InboxListNewParamsDirection added in v0.4.0

type InboxListNewParamsDirection string

Direction of list entry.

const (
	InboxListNewParamsDirectionSend    InboxListNewParamsDirection = "send"
	InboxListNewParamsDirectionReceive InboxListNewParamsDirection = "receive"
	InboxListNewParamsDirectionReply   InboxListNewParamsDirection = "reply"
)

type InboxListNewParamsType added in v0.4.0

type InboxListNewParamsType string

Type of list entry.

const (
	InboxListNewParamsTypeAllow InboxListNewParamsType = "allow"
	InboxListNewParamsTypeBlock InboxListNewParamsType = "block"
)

type InboxListNewResponse added in v0.4.0

type InboxListNewResponse struct {
	// Time at which entry was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction InboxListNewResponseDirection `json:"direction" api:"required"`
	// Email address or domain of list entry.
	Entry string `json:"entry" api:"required"`
	// Whether the entry is an email address or domain.
	//
	// Any of "email", "domain".
	EntryType InboxListNewResponseEntryType `json:"entry_type" api:"required"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	ListType InboxListNewResponseListType `json:"list_type" api:"required"`
	// ID of organization.
	OrganizationID string `json:"organization_id" api:"required"`
	// ID of pod.
	PodID string `json:"pod_id" api:"required"`
	// ID of inbox, if entry is inbox-scoped.
	InboxID string `json:"inbox_id" api:"nullable"`
	// Reason for adding the entry.
	Reason string `json:"reason" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt      respjson.Field
		Direction      respjson.Field
		Entry          respjson.Field
		EntryType      respjson.Field
		ListType       respjson.Field
		OrganizationID respjson.Field
		PodID          respjson.Field
		InboxID        respjson.Field
		Reason         respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxListNewResponse) RawJSON added in v0.4.0

func (r InboxListNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InboxListNewResponse) UnmarshalJSON added in v0.4.0

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

type InboxListNewResponseDirection added in v0.4.0

type InboxListNewResponseDirection string

Direction of list entry.

const (
	InboxListNewResponseDirectionSend    InboxListNewResponseDirection = "send"
	InboxListNewResponseDirectionReceive InboxListNewResponseDirection = "receive"
	InboxListNewResponseDirectionReply   InboxListNewResponseDirection = "reply"
)

type InboxListNewResponseEntryType added in v0.4.0

type InboxListNewResponseEntryType string

Whether the entry is an email address or domain.

const (
	InboxListNewResponseEntryTypeEmail  InboxListNewResponseEntryType = "email"
	InboxListNewResponseEntryTypeDomain InboxListNewResponseEntryType = "domain"
)

type InboxListNewResponseListType added in v0.4.0

type InboxListNewResponseListType string

Type of list entry.

const (
	InboxListNewResponseListTypeAllow InboxListNewResponseListType = "allow"
	InboxListNewResponseListTypeBlock InboxListNewResponseListType = "block"
)

type InboxListParams

type InboxListParams struct {
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (InboxListParams) URLQuery

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

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

type InboxListService added in v0.4.0

type InboxListService struct {
	Options []option.RequestOption
}

InboxListService contains methods and other services that help with interacting with the agentmail 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 NewInboxListService method instead.

func NewInboxListService added in v0.4.0

func NewInboxListService(opts ...option.RequestOption) (r InboxListService)

NewInboxListService 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 (*InboxListService) Delete added in v0.4.0

func (r *InboxListService) Delete(ctx context.Context, entry string, body InboxListDeleteParams, opts ...option.RequestOption) (err error)

**CLI:**

```bash agentmail inboxes:lists delete --inbox-id <inbox_id> --direction <direction> --type <type> --entry <entry> ```

func (*InboxListService) Get added in v0.4.0

**CLI:**

```bash agentmail inboxes:lists get --inbox-id <inbox_id> --direction <direction> --type <type> --entry <entry> ```

func (*InboxListService) List added in v0.4.0

**CLI:**

```bash agentmail inboxes:lists list --inbox-id <inbox_id> --direction <direction> --type <type> ```

func (*InboxListService) New added in v0.4.0

**CLI:**

```bash agentmail inboxes:lists create --inbox-id <inbox_id> --direction <direction> --type <type> --entry user@example.com ```

type InboxMessageForwardParams

type InboxMessageForwardParams struct {
	// The ID of the inbox.
	InboxID            string `path:"inbox_id" api:"required" json:"-"`
	SendMessageRequest SendMessageRequestParam
	// contains filtered or unexported fields
}

func (InboxMessageForwardParams) MarshalJSON

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

func (*InboxMessageForwardParams) UnmarshalJSON

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

type InboxMessageGetAttachmentParams

type InboxMessageGetAttachmentParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// ID of message.
	MessageID string `path:"message_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type InboxMessageGetParams

type InboxMessageGetParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type InboxMessageGetRawParams

type InboxMessageGetRawParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type InboxMessageGetRawResponse

type InboxMessageGetRawResponse struct {
	// S3 presigned URL to download the raw message. Expires at expires_at.
	DownloadURL string `json:"download_url" api:"required"`
	// Time at which the download URL expires.
	ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"`
	// ID of the message.
	MessageID string `json:"message_id" api:"required"`
	// Size of the raw message in bytes.
	Size int64 `json:"size" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DownloadURL respjson.Field
		ExpiresAt   respjson.Field
		MessageID   respjson.Field
		Size        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

S3 presigned URL to download the raw .eml file.

func (InboxMessageGetRawResponse) RawJSON

func (r InboxMessageGetRawResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InboxMessageGetRawResponse) UnmarshalJSON

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

type InboxMessageListParams

type InboxMessageListParams struct {
	// Timestamp after which to filter by.
	After param.Opt[time.Time] `query:"after,omitzero" format:"date-time" json:"-"`
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Timestamp before which to filter by.
	Before param.Opt[time.Time] `query:"before,omitzero" format:"date-time" json:"-"`
	// Include blocked in results.
	IncludeBlocked param.Opt[bool] `query:"include_blocked,omitzero" json:"-"`
	// Include spam in results.
	IncludeSpam param.Opt[bool] `query:"include_spam,omitzero" json:"-"`
	// Include trash in results.
	IncludeTrash param.Opt[bool] `query:"include_trash,omitzero" json:"-"`
	// Include unauthenticated in results.
	IncludeUnauthenticated param.Opt[bool] `query:"include_unauthenticated,omitzero" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// Labels to filter by.
	Labels []string `query:"labels,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (InboxMessageListParams) URLQuery

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

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

type InboxMessageListResponse

type InboxMessageListResponse struct {
	// Number of items returned.
	Count int64 `json:"count" api:"required"`
	// Ordered by `timestamp` descending.
	Messages []InboxMessageListResponseMessage `json:"messages" api:"required"`
	// Limit of number of items returned.
	Limit int64 `json:"limit" api:"nullable"`
	// Page token for pagination.
	NextPageToken string `json:"next_page_token" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count         respjson.Field
		Messages      respjson.Field
		Limit         respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxMessageListResponse) RawJSON

func (r InboxMessageListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InboxMessageListResponse) UnmarshalJSON

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

type InboxMessageListResponseMessage

type InboxMessageListResponseMessage struct {
	// Time at which message was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Address of sender. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	From string `json:"from" api:"required"`
	// The ID of the inbox.
	InboxID string `json:"inbox_id" api:"required"`
	// Labels of message.
	Labels []string `json:"labels" api:"required"`
	// ID of message.
	MessageID string `json:"message_id" api:"required"`
	// Size of message in bytes.
	Size int64 `json:"size" api:"required"`
	// ID of thread.
	ThreadID string `json:"thread_id" api:"required"`
	// Time at which message was sent or drafted.
	Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"`
	// Addresses of recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	To []string `json:"to" api:"required"`
	// Time at which message was last updated.
	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
	// Attachments in message.
	Attachments []AttachmentFile `json:"attachments" api:"nullable"`
	// Addresses of BCC recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Bcc []string `json:"bcc" api:"nullable"`
	// Addresses of CC recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Cc []string `json:"cc" api:"nullable"`
	// Headers in message.
	Headers map[string]string `json:"headers" api:"nullable"`
	// ID of message being replied to.
	InReplyTo string `json:"in_reply_to" api:"nullable"`
	// Text preview of message.
	Preview string `json:"preview" api:"nullable"`
	// IDs of previous messages in thread.
	References []string `json:"references" api:"nullable"`
	// Subject of message.
	Subject string `json:"subject" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		From        respjson.Field
		InboxID     respjson.Field
		Labels      respjson.Field
		MessageID   respjson.Field
		Size        respjson.Field
		ThreadID    respjson.Field
		Timestamp   respjson.Field
		To          respjson.Field
		UpdatedAt   respjson.Field
		Attachments respjson.Field
		Bcc         respjson.Field
		Cc          respjson.Field
		Headers     respjson.Field
		InReplyTo   respjson.Field
		Preview     respjson.Field
		References  respjson.Field
		Subject     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxMessageListResponseMessage) RawJSON

Returns the unmodified JSON received from the API

func (*InboxMessageListResponseMessage) UnmarshalJSON

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

type InboxMessageReplyAllParams

type InboxMessageReplyAllParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// HTML body of message.
	HTML param.Opt[string] `json:"html,omitzero"`
	// Plain text body of message.
	Text param.Opt[string] `json:"text,omitzero"`
	// Attachments to include in message.
	Attachments []SendAttachmentParam `json:"attachments,omitzero"`
	// Headers to include in message.
	Headers map[string]string `json:"headers,omitzero"`
	// Labels of message.
	Labels []string `json:"labels,omitzero"`
	// Reply-to address or addresses.
	ReplyTo AddressesUnionParam `json:"reply_to,omitzero"`
	// contains filtered or unexported fields
}

func (InboxMessageReplyAllParams) MarshalJSON

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

func (*InboxMessageReplyAllParams) UnmarshalJSON

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

type InboxMessageReplyParams

type InboxMessageReplyParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// HTML body of message.
	HTML param.Opt[string] `json:"html,omitzero"`
	// Reply to all recipients of the original message.
	ReplyAll param.Opt[bool] `json:"reply_all,omitzero"`
	// Plain text body of message.
	Text param.Opt[string] `json:"text,omitzero"`
	// Attachments to include in message.
	Attachments []SendAttachmentParam `json:"attachments,omitzero"`
	// Headers to include in message.
	Headers map[string]string `json:"headers,omitzero"`
	// Labels of message.
	Labels []string `json:"labels,omitzero"`
	// BCC recipient address or addresses.
	Bcc AddressesUnionParam `json:"bcc,omitzero"`
	// CC recipient address or addresses.
	Cc AddressesUnionParam `json:"cc,omitzero"`
	// Reply-to address or addresses.
	ReplyTo AddressesUnionParam `json:"reply_to,omitzero"`
	// Recipient address or addresses.
	To AddressesUnionParam `json:"to,omitzero"`
	// contains filtered or unexported fields
}

func (InboxMessageReplyParams) MarshalJSON

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

func (*InboxMessageReplyParams) UnmarshalJSON

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

type InboxMessageSendParams

type InboxMessageSendParams struct {
	SendMessageRequest SendMessageRequestParam
	// contains filtered or unexported fields
}

func (InboxMessageSendParams) MarshalJSON

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

func (*InboxMessageSendParams) UnmarshalJSON

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

type InboxMessageService

type InboxMessageService struct {
	Options []option.RequestOption
}

InboxMessageService contains methods and other services that help with interacting with the agentmail 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 NewInboxMessageService method instead.

func NewInboxMessageService

func NewInboxMessageService(opts ...option.RequestOption) (r InboxMessageService)

NewInboxMessageService 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 (*InboxMessageService) Forward

func (r *InboxMessageService) Forward(ctx context.Context, messageID string, params InboxMessageForwardParams, opts ...option.RequestOption) (res *SendMessageResponse, err error)

**CLI:**

```bash agentmail inboxes:messages forward --inbox-id <inbox_id> --message-id <message_id> --to recipient@example.com ```

func (*InboxMessageService) Get

func (r *InboxMessageService) Get(ctx context.Context, messageID string, query InboxMessageGetParams, opts ...option.RequestOption) (res *Message, err error)

**CLI:**

```bash agentmail inboxes:messages get --inbox-id <inbox_id> --message-id <message_id> ```

func (*InboxMessageService) GetAttachment

func (r *InboxMessageService) GetAttachment(ctx context.Context, attachmentID string, query InboxMessageGetAttachmentParams, opts ...option.RequestOption) (res *AttachmentResponse, err error)

**CLI:**

```bash agentmail inboxes:messages get-attachment --inbox-id <inbox_id> --message-id <message_id> --attachment-id <attachment_id> ```

func (*InboxMessageService) GetRaw

**CLI:**

```bash agentmail inboxes:messages get-raw --inbox-id <inbox_id> --message-id <message_id> ```

func (*InboxMessageService) List

**CLI:**

```bash agentmail inboxes:messages list --inbox-id <inbox_id> ```

func (*InboxMessageService) Reply

func (r *InboxMessageService) Reply(ctx context.Context, messageID string, params InboxMessageReplyParams, opts ...option.RequestOption) (res *SendMessageResponse, err error)

**CLI:**

```bash agentmail inboxes:messages reply --inbox-id <inbox_id> --message-id <message_id> --text "Reply text" ```

func (*InboxMessageService) ReplyAll

func (r *InboxMessageService) ReplyAll(ctx context.Context, messageID string, params InboxMessageReplyAllParams, opts ...option.RequestOption) (res *SendMessageResponse, err error)

**CLI:**

```bash agentmail inboxes:messages reply-all --inbox-id <inbox_id> --message-id <message_id> --text "Reply text" ```

func (*InboxMessageService) Send

**CLI:**

```bash agentmail inboxes:messages send --inbox-id <inbox_id> --to recipient@example.com --subject "Hello" --text "Body" ```

func (*InboxMessageService) Update

**CLI:**

```bash agentmail inboxes:messages update --inbox-id <inbox_id> --message-id <message_id> --add-label read --remove-label unread ```

type InboxMessageUpdateParams

type InboxMessageUpdateParams struct {
	// The ID of the inbox.
	InboxID       string `path:"inbox_id" api:"required" json:"-"`
	UpdateMessage UpdateMessageParam
	// contains filtered or unexported fields
}

func (InboxMessageUpdateParams) MarshalJSON

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

func (*InboxMessageUpdateParams) UnmarshalJSON

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

type InboxMessageUpdateResponse added in v0.2.0

type InboxMessageUpdateResponse struct {
	// Labels of message.
	Labels []string `json:"labels" api:"required"`
	// ID of message.
	MessageID string `json:"message_id" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Labels      respjson.Field
		MessageID   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxMessageUpdateResponse) RawJSON added in v0.2.0

func (r InboxMessageUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InboxMessageUpdateResponse) UnmarshalJSON added in v0.2.0

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

type InboxNewParams

type InboxNewParams struct {
	CreateInbox CreateInboxParam
	// contains filtered or unexported fields
}

func (InboxNewParams) MarshalJSON

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

func (*InboxNewParams) UnmarshalJSON

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

type InboxService

type InboxService struct {
	Options  []option.RequestOption
	Drafts   InboxDraftService
	Messages InboxMessageService
	Threads  InboxThreadService
	Lists    InboxListService
	APIKeys  InboxAPIKeyService
}

InboxService contains methods and other services that help with interacting with the agentmail 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 NewInboxService method instead.

func NewInboxService

func NewInboxService(opts ...option.RequestOption) (r InboxService)

NewInboxService 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 (*InboxService) Delete

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

**CLI:**

```bash agentmail inboxes delete --inbox-id <inbox_id> ```

func (*InboxService) Get

func (r *InboxService) Get(ctx context.Context, inboxID string, opts ...option.RequestOption) (res *Inbox, err error)

**CLI:**

```bash agentmail inboxes get --inbox-id <inbox_id> ```

func (*InboxService) List

func (r *InboxService) List(ctx context.Context, query InboxListParams, opts ...option.RequestOption) (res *ListInboxes, err error)

**CLI:**

```bash agentmail inboxes list ```

func (*InboxService) ListMetrics

func (r *InboxService) ListMetrics(ctx context.Context, inboxID string, query InboxListMetricsParams, opts ...option.RequestOption) (res *InboxListMetricsResponse, err error)

**CLI:**

```bash agentmail inboxes:metrics query --inbox-id <inbox_id> ```

func (*InboxService) New

func (r *InboxService) New(ctx context.Context, body InboxNewParams, opts ...option.RequestOption) (res *Inbox, err error)

**CLI:**

```bash agentmail inboxes create --display-name "My Agent" --username myagent --domain agentmail.to ```

func (*InboxService) Update

func (r *InboxService) Update(ctx context.Context, inboxID string, body InboxUpdateParams, opts ...option.RequestOption) (res *Inbox, err error)

**CLI:**

```bash agentmail inboxes update --inbox-id <inbox_id> --display-name "Updated Name" ```

type InboxThreadDeleteParams

type InboxThreadDeleteParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// If true, permanently delete the thread instead of moving to trash.
	Permanent param.Opt[bool] `query:"permanent,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (InboxThreadDeleteParams) URLQuery added in v0.2.0

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

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

type InboxThreadGetAttachmentParams

type InboxThreadGetAttachmentParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// ID of thread.
	ThreadID string `path:"thread_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type InboxThreadGetParams

type InboxThreadGetParams struct {
	// The ID of the inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type InboxThreadListParams

type InboxThreadListParams struct {
	// Timestamp after which to filter by.
	After param.Opt[time.Time] `query:"after,omitzero" format:"date-time" json:"-"`
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Timestamp before which to filter by.
	Before param.Opt[time.Time] `query:"before,omitzero" format:"date-time" json:"-"`
	// Include blocked in results.
	IncludeBlocked param.Opt[bool] `query:"include_blocked,omitzero" json:"-"`
	// Include spam in results.
	IncludeSpam param.Opt[bool] `query:"include_spam,omitzero" json:"-"`
	// Include trash in results.
	IncludeTrash param.Opt[bool] `query:"include_trash,omitzero" json:"-"`
	// Include unauthenticated in results.
	IncludeUnauthenticated param.Opt[bool] `query:"include_unauthenticated,omitzero" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// Labels to filter by.
	Labels []string `query:"labels,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (InboxThreadListParams) URLQuery

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

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

type InboxThreadService

type InboxThreadService struct {
	Options []option.RequestOption
}

InboxThreadService contains methods and other services that help with interacting with the agentmail 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 NewInboxThreadService method instead.

func NewInboxThreadService

func NewInboxThreadService(opts ...option.RequestOption) (r InboxThreadService)

NewInboxThreadService 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 (*InboxThreadService) Delete

func (r *InboxThreadService) Delete(ctx context.Context, threadID string, params InboxThreadDeleteParams, opts ...option.RequestOption) (err error)

Moves the thread to trash by adding a trash label to all messages. If the thread is already in trash, it will be permanently deleted. Use `permanent=true` to force permanent deletion.

**CLI:**

```bash agentmail inboxes:threads delete --inbox-id <inbox_id> --thread-id <thread_id> ```

func (*InboxThreadService) Get

func (r *InboxThreadService) Get(ctx context.Context, threadID string, query InboxThreadGetParams, opts ...option.RequestOption) (res *Thread, err error)

**CLI:**

```bash agentmail inboxes:threads get --inbox-id <inbox_id> --thread-id <thread_id> ```

func (*InboxThreadService) GetAttachment

func (r *InboxThreadService) GetAttachment(ctx context.Context, attachmentID string, query InboxThreadGetAttachmentParams, opts ...option.RequestOption) (res *AttachmentResponse, err error)

**CLI:**

```bash agentmail inboxes:threads get-attachment --inbox-id <inbox_id> --thread-id <thread_id> --attachment-id <attachment_id> ```

func (*InboxThreadService) List

func (r *InboxThreadService) List(ctx context.Context, inboxID string, query InboxThreadListParams, opts ...option.RequestOption) (res *ListThreads, err error)

**CLI:**

```bash agentmail inboxes:threads list --inbox-id <inbox_id> ```

type InboxUpdateParams

type InboxUpdateParams struct {
	// Display name: `Display Name <username@domain.com>`.
	DisplayName string `json:"display_name" api:"required"`
	// contains filtered or unexported fields
}

func (InboxUpdateParams) MarshalJSON

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

func (*InboxUpdateParams) UnmarshalJSON

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

type ListDeleteParams added in v0.4.0

type ListDeleteParams struct {
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction ListDeleteParamsDirection `path:"direction,omitzero" api:"required" json:"-"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	Type ListDeleteParamsType `path:"type,omitzero" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type ListDeleteParamsDirection added in v0.4.0

type ListDeleteParamsDirection string

Direction of list entry.

const (
	ListDeleteParamsDirectionSend    ListDeleteParamsDirection = "send"
	ListDeleteParamsDirectionReceive ListDeleteParamsDirection = "receive"
	ListDeleteParamsDirectionReply   ListDeleteParamsDirection = "reply"
)

type ListDeleteParamsType added in v0.4.0

type ListDeleteParamsType string

Type of list entry.

const (
	ListDeleteParamsTypeAllow ListDeleteParamsType = "allow"
	ListDeleteParamsTypeBlock ListDeleteParamsType = "block"
)

type ListDomains

type ListDomains struct {
	// Number of items returned.
	Count int64 `json:"count" api:"required"`
	// Ordered by `created_at` descending.
	Domains []ListDomainsDomain `json:"domains" api:"required"`
	// Limit of number of items returned.
	Limit int64 `json:"limit" api:"nullable"`
	// Page token for pagination.
	NextPageToken string `json:"next_page_token" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count         respjson.Field
		Domains       respjson.Field
		Limit         respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListDomains) RawJSON

func (r ListDomains) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListDomains) UnmarshalJSON

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

type ListDomainsDomain

type ListDomainsDomain struct {
	// Time at which the domain was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// The name of the domain (e.g., `example.com`).
	Domain string `json:"domain" api:"required"`
	// The ID of the domain.
	DomainID string `json:"domain_id" api:"required"`
	// Bounce and complaint notifications are sent to your inboxes.
	FeedbackEnabled bool `json:"feedback_enabled" api:"required"`
	// Time at which the domain was last updated.
	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
	// Client ID of domain.
	ClientID string `json:"client_id" api:"nullable"`
	// ID of pod.
	PodID string `json:"pod_id" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt       respjson.Field
		Domain          respjson.Field
		DomainID        respjson.Field
		FeedbackEnabled respjson.Field
		UpdatedAt       respjson.Field
		ClientID        respjson.Field
		PodID           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListDomainsDomain) RawJSON

func (r ListDomainsDomain) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListDomainsDomain) UnmarshalJSON

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

type ListDrafts

type ListDrafts struct {
	// Number of items returned.
	Count int64 `json:"count" api:"required"`
	// Ordered by `updated_at` descending.
	Drafts []ListDraftsDraft `json:"drafts" api:"required"`
	// Limit of number of items returned.
	Limit int64 `json:"limit" api:"nullable"`
	// Page token for pagination.
	NextPageToken string `json:"next_page_token" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count         respjson.Field
		Drafts        respjson.Field
		Limit         respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListDrafts) RawJSON

func (r ListDrafts) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListDrafts) UnmarshalJSON

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

type ListDraftsDraft

type ListDraftsDraft struct {
	// ID of draft.
	DraftID string `json:"draft_id" api:"required"`
	// The ID of the inbox.
	InboxID string `json:"inbox_id" api:"required"`
	// Labels of draft.
	Labels []string `json:"labels" api:"required"`
	// Time at which draft was last updated.
	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
	// Attachments in draft.
	Attachments []AttachmentFile `json:"attachments" api:"nullable"`
	// Addresses of BCC recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Bcc []string `json:"bcc" api:"nullable"`
	// Addresses of CC recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Cc []string `json:"cc" api:"nullable"`
	// ID of message being replied to.
	InReplyTo string `json:"in_reply_to" api:"nullable"`
	// Text preview of draft.
	Preview string `json:"preview" api:"nullable"`
	// Time at which to schedule send draft.
	SendAt time.Time `json:"send_at" api:"nullable" format:"date-time"`
	// Schedule send status of draft.
	//
	// Any of "scheduled", "sending", "failed".
	SendStatus DraftSendStatus `json:"send_status" api:"nullable"`
	// Subject of draft.
	Subject string `json:"subject" api:"nullable"`
	// Addresses of recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	To []string `json:"to" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DraftID     respjson.Field
		InboxID     respjson.Field
		Labels      respjson.Field
		UpdatedAt   respjson.Field
		Attachments respjson.Field
		Bcc         respjson.Field
		Cc          respjson.Field
		InReplyTo   respjson.Field
		Preview     respjson.Field
		SendAt      respjson.Field
		SendStatus  respjson.Field
		Subject     respjson.Field
		To          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListDraftsDraft) RawJSON

func (r ListDraftsDraft) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListDraftsDraft) UnmarshalJSON

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

type ListGetParams added in v0.4.0

type ListGetParams struct {
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction ListGetParamsDirection `path:"direction,omitzero" api:"required" json:"-"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	Type ListGetParamsType `path:"type,omitzero" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type ListGetParamsDirection added in v0.4.0

type ListGetParamsDirection string

Direction of list entry.

const (
	ListGetParamsDirectionSend    ListGetParamsDirection = "send"
	ListGetParamsDirectionReceive ListGetParamsDirection = "receive"
	ListGetParamsDirectionReply   ListGetParamsDirection = "reply"
)

type ListGetParamsType added in v0.4.0

type ListGetParamsType string

Type of list entry.

const (
	ListGetParamsTypeAllow ListGetParamsType = "allow"
	ListGetParamsTypeBlock ListGetParamsType = "block"
)

type ListGetResponse added in v0.4.0

type ListGetResponse struct {
	// Time at which entry was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction ListGetResponseDirection `json:"direction" api:"required"`
	// Email address or domain of list entry.
	Entry string `json:"entry" api:"required"`
	// Whether the entry is an email address or domain.
	//
	// Any of "email", "domain".
	EntryType ListGetResponseEntryType `json:"entry_type" api:"required"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	ListType ListGetResponseListType `json:"list_type" api:"required"`
	// ID of organization.
	OrganizationID string `json:"organization_id" api:"required"`
	// Reason for adding the entry.
	Reason string `json:"reason" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt      respjson.Field
		Direction      respjson.Field
		Entry          respjson.Field
		EntryType      respjson.Field
		ListType       respjson.Field
		OrganizationID respjson.Field
		Reason         respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListGetResponse) RawJSON added in v0.4.0

func (r ListGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListGetResponse) UnmarshalJSON added in v0.4.0

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

type ListGetResponseDirection added in v0.4.0

type ListGetResponseDirection string

Direction of list entry.

const (
	ListGetResponseDirectionSend    ListGetResponseDirection = "send"
	ListGetResponseDirectionReceive ListGetResponseDirection = "receive"
	ListGetResponseDirectionReply   ListGetResponseDirection = "reply"
)

type ListGetResponseEntryType added in v0.4.0

type ListGetResponseEntryType string

Whether the entry is an email address or domain.

const (
	ListGetResponseEntryTypeEmail  ListGetResponseEntryType = "email"
	ListGetResponseEntryTypeDomain ListGetResponseEntryType = "domain"
)

type ListGetResponseListType added in v0.4.0

type ListGetResponseListType string

Type of list entry.

const (
	ListGetResponseListTypeAllow ListGetResponseListType = "allow"
	ListGetResponseListTypeBlock ListGetResponseListType = "block"
)

type ListInboxes

type ListInboxes struct {
	// Number of items returned.
	Count int64 `json:"count" api:"required"`
	// Ordered by `created_at` descending.
	Inboxes []Inbox `json:"inboxes" api:"required"`
	// Limit of number of items returned.
	Limit int64 `json:"limit" api:"nullable"`
	// Page token for pagination.
	NextPageToken string `json:"next_page_token" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count         respjson.Field
		Inboxes       respjson.Field
		Limit         respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListInboxes) RawJSON

func (r ListInboxes) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListInboxes) UnmarshalJSON

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

type ListListParams added in v0.4.0

type ListListParams struct {
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction ListListParamsDirection `path:"direction,omitzero" api:"required" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ListListParams) URLQuery added in v0.4.0

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

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

type ListListParamsDirection added in v0.4.0

type ListListParamsDirection string

Direction of list entry.

const (
	ListListParamsDirectionSend    ListListParamsDirection = "send"
	ListListParamsDirectionReceive ListListParamsDirection = "receive"
	ListListParamsDirectionReply   ListListParamsDirection = "reply"
)

type ListListParamsType added in v0.4.0

type ListListParamsType string

Type of list entry.

const (
	ListListParamsTypeAllow ListListParamsType = "allow"
	ListListParamsTypeBlock ListListParamsType = "block"
)

type ListListResponse added in v0.4.0

type ListListResponse struct {
	// Number of items returned.
	Count int64 `json:"count" api:"required"`
	// Ordered by entry ascending.
	Entries []ListListResponseEntry `json:"entries" api:"required"`
	// Limit of number of items returned.
	Limit int64 `json:"limit" api:"nullable"`
	// Page token for pagination.
	NextPageToken string `json:"next_page_token" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count         respjson.Field
		Entries       respjson.Field
		Limit         respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListListResponse) RawJSON added in v0.4.0

func (r ListListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListListResponse) UnmarshalJSON added in v0.4.0

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

type ListListResponseEntry added in v0.4.0

type ListListResponseEntry struct {
	// Time at which entry was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction string `json:"direction" api:"required"`
	// Email address or domain of list entry.
	Entry string `json:"entry" api:"required"`
	// Whether the entry is an email address or domain.
	//
	// Any of "email", "domain".
	EntryType string `json:"entry_type" api:"required"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	ListType string `json:"list_type" api:"required"`
	// ID of organization.
	OrganizationID string `json:"organization_id" api:"required"`
	// Reason for adding the entry.
	Reason string `json:"reason" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt      respjson.Field
		Direction      respjson.Field
		Entry          respjson.Field
		EntryType      respjson.Field
		ListType       respjson.Field
		OrganizationID respjson.Field
		Reason         respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListListResponseEntry) RawJSON added in v0.4.0

func (r ListListResponseEntry) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListListResponseEntry) UnmarshalJSON added in v0.4.0

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

type ListNewParams added in v0.4.0

type ListNewParams struct {
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction ListNewParamsDirection `path:"direction,omitzero" api:"required" json:"-"`
	// Email address or domain to add.
	Entry string `json:"entry" api:"required"`
	// Reason for adding the entry.
	Reason param.Opt[string] `json:"reason,omitzero"`
	// contains filtered or unexported fields
}

func (ListNewParams) MarshalJSON added in v0.4.0

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

func (*ListNewParams) UnmarshalJSON added in v0.4.0

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

type ListNewParamsDirection added in v0.4.0

type ListNewParamsDirection string

Direction of list entry.

const (
	ListNewParamsDirectionSend    ListNewParamsDirection = "send"
	ListNewParamsDirectionReceive ListNewParamsDirection = "receive"
	ListNewParamsDirectionReply   ListNewParamsDirection = "reply"
)

type ListNewParamsType added in v0.4.0

type ListNewParamsType string

Type of list entry.

const (
	ListNewParamsTypeAllow ListNewParamsType = "allow"
	ListNewParamsTypeBlock ListNewParamsType = "block"
)

type ListNewResponse added in v0.4.0

type ListNewResponse struct {
	// Time at which entry was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction ListNewResponseDirection `json:"direction" api:"required"`
	// Email address or domain of list entry.
	Entry string `json:"entry" api:"required"`
	// Whether the entry is an email address or domain.
	//
	// Any of "email", "domain".
	EntryType ListNewResponseEntryType `json:"entry_type" api:"required"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	ListType ListNewResponseListType `json:"list_type" api:"required"`
	// ID of organization.
	OrganizationID string `json:"organization_id" api:"required"`
	// Reason for adding the entry.
	Reason string `json:"reason" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt      respjson.Field
		Direction      respjson.Field
		Entry          respjson.Field
		EntryType      respjson.Field
		ListType       respjson.Field
		OrganizationID respjson.Field
		Reason         respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListNewResponse) RawJSON added in v0.4.0

func (r ListNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListNewResponse) UnmarshalJSON added in v0.4.0

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

type ListNewResponseDirection added in v0.4.0

type ListNewResponseDirection string

Direction of list entry.

const (
	ListNewResponseDirectionSend    ListNewResponseDirection = "send"
	ListNewResponseDirectionReceive ListNewResponseDirection = "receive"
	ListNewResponseDirectionReply   ListNewResponseDirection = "reply"
)

type ListNewResponseEntryType added in v0.4.0

type ListNewResponseEntryType string

Whether the entry is an email address or domain.

const (
	ListNewResponseEntryTypeEmail  ListNewResponseEntryType = "email"
	ListNewResponseEntryTypeDomain ListNewResponseEntryType = "domain"
)

type ListNewResponseListType added in v0.4.0

type ListNewResponseListType string

Type of list entry.

const (
	ListNewResponseListTypeAllow ListNewResponseListType = "allow"
	ListNewResponseListTypeBlock ListNewResponseListType = "block"
)

type ListService added in v0.4.0

type ListService struct {
	Options []option.RequestOption
}

ListService contains methods and other services that help with interacting with the agentmail 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 NewListService method instead.

func NewListService added in v0.4.0

func NewListService(opts ...option.RequestOption) (r ListService)

NewListService 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 (*ListService) Delete added in v0.4.0

func (r *ListService) Delete(ctx context.Context, entry string, body ListDeleteParams, opts ...option.RequestOption) (err error)

**CLI:**

```bash agentmail lists delete --direction <direction> --type <type> --entry <entry> ```

func (*ListService) Get added in v0.4.0

func (r *ListService) Get(ctx context.Context, entry string, query ListGetParams, opts ...option.RequestOption) (res *ListGetResponse, err error)

**CLI:**

```bash agentmail lists get --direction <direction> --type <type> --entry <entry> ```

func (*ListService) List added in v0.4.0

func (r *ListService) List(ctx context.Context, type_ ListListParamsType, params ListListParams, opts ...option.RequestOption) (res *ListListResponse, err error)

**CLI:**

```bash agentmail lists list --direction <direction> --type <type> ```

func (*ListService) New added in v0.4.0

func (r *ListService) New(ctx context.Context, type_ ListNewParamsType, params ListNewParams, opts ...option.RequestOption) (res *ListNewResponse, err error)

**CLI:**

```bash agentmail lists create --direction <direction> --type <type> --entry user@example.com ```

type ListThreads

type ListThreads struct {
	// Number of items returned.
	Count int64 `json:"count" api:"required"`
	// Ordered by `timestamp` descending.
	Threads []ListThreadsThread `json:"threads" api:"required"`
	// Limit of number of items returned.
	Limit int64 `json:"limit" api:"nullable"`
	// Page token for pagination.
	NextPageToken string `json:"next_page_token" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count         respjson.Field
		Threads       respjson.Field
		Limit         respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListThreads) RawJSON

func (r ListThreads) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListThreads) UnmarshalJSON

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

type ListThreadsThread

type ListThreadsThread struct {
	// Time at which thread was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// The ID of the inbox.
	InboxID string `json:"inbox_id" api:"required"`
	// Labels of thread.
	Labels []string `json:"labels" api:"required"`
	// ID of last message in thread.
	LastMessageID string `json:"last_message_id" api:"required"`
	// Number of messages in thread.
	MessageCount int64 `json:"message_count" api:"required"`
	// Recipients in thread. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Recipients []string `json:"recipients" api:"required"`
	// Senders in thread. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Senders []string `json:"senders" api:"required"`
	// Size of thread in bytes.
	Size int64 `json:"size" api:"required"`
	// ID of thread.
	ThreadID string `json:"thread_id" api:"required"`
	// Timestamp of last sent or received message.
	Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"`
	// Time at which thread was last updated.
	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
	// Attachments in thread.
	Attachments []AttachmentFile `json:"attachments" api:"nullable"`
	// Text preview of last message in thread.
	Preview string `json:"preview" api:"nullable"`
	// Timestamp of last received message.
	ReceivedTimestamp time.Time `json:"received_timestamp" api:"nullable" format:"date-time"`
	// Timestamp of last sent message.
	SentTimestamp time.Time `json:"sent_timestamp" api:"nullable" format:"date-time"`
	// Subject of thread.
	Subject string `json:"subject" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt         respjson.Field
		InboxID           respjson.Field
		Labels            respjson.Field
		LastMessageID     respjson.Field
		MessageCount      respjson.Field
		Recipients        respjson.Field
		Senders           respjson.Field
		Size              respjson.Field
		ThreadID          respjson.Field
		Timestamp         respjson.Field
		UpdatedAt         respjson.Field
		Attachments       respjson.Field
		Preview           respjson.Field
		ReceivedTimestamp respjson.Field
		SentTimestamp     respjson.Field
		Subject           respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListThreadsThread) RawJSON

func (r ListThreadsThread) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListThreadsThread) UnmarshalJSON

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

type Message

type Message struct {
	// Time at which message was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Address of sender. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	From string `json:"from" api:"required"`
	// The ID of the inbox.
	InboxID string `json:"inbox_id" api:"required"`
	// Labels of message.
	Labels []string `json:"labels" api:"required"`
	// ID of message.
	MessageID string `json:"message_id" api:"required"`
	// Size of message in bytes.
	Size int64 `json:"size" api:"required"`
	// ID of thread.
	ThreadID string `json:"thread_id" api:"required"`
	// Time at which message was sent or drafted.
	Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"`
	// Addresses of recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	To []string `json:"to" api:"required"`
	// Time at which message was last updated.
	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
	// Attachments in message.
	Attachments []AttachmentFile `json:"attachments" api:"nullable"`
	// Addresses of BCC recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Bcc []string `json:"bcc" api:"nullable"`
	// Addresses of CC recipients. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Cc []string `json:"cc" api:"nullable"`
	// Extracted new HTML content.
	ExtractedHTML string `json:"extracted_html" api:"nullable"`
	// Extracted new text content.
	ExtractedText string `json:"extracted_text" api:"nullable"`
	// Headers in message.
	Headers map[string]string `json:"headers" api:"nullable"`
	// HTML body of message.
	HTML string `json:"html" api:"nullable"`
	// ID of message being replied to.
	InReplyTo string `json:"in_reply_to" api:"nullable"`
	// Text preview of message.
	Preview string `json:"preview" api:"nullable"`
	// IDs of previous messages in thread.
	References []string `json:"references" api:"nullable"`
	// Reply-to addresses. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	ReplyTo []string `json:"reply_to" api:"nullable"`
	// Subject of message.
	Subject string `json:"subject" api:"nullable"`
	// Plain text body of message.
	Text string `json:"text" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt     respjson.Field
		From          respjson.Field
		InboxID       respjson.Field
		Labels        respjson.Field
		MessageID     respjson.Field
		Size          respjson.Field
		ThreadID      respjson.Field
		Timestamp     respjson.Field
		To            respjson.Field
		UpdatedAt     respjson.Field
		Attachments   respjson.Field
		Bcc           respjson.Field
		Cc            respjson.Field
		ExtractedHTML respjson.Field
		ExtractedText respjson.Field
		Headers       respjson.Field
		HTML          respjson.Field
		InReplyTo     respjson.Field
		Preview       respjson.Field
		References    respjson.Field
		ReplyTo       respjson.Field
		Subject       respjson.Field
		Text          respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Message) RawJSON

func (r Message) RawJSON() string

Returns the unmodified JSON received from the API

func (*Message) UnmarshalJSON

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

type MetricEventType

type MetricEventType string

Type of metric event.

const (
	MetricEventTypeMessageSent       MetricEventType = "message.sent"
	MetricEventTypeMessageDelivered  MetricEventType = "message.delivered"
	MetricEventTypeMessageBounced    MetricEventType = "message.bounced"
	MetricEventTypeMessageDelayed    MetricEventType = "message.delayed"
	MetricEventTypeMessageRejected   MetricEventType = "message.rejected"
	MetricEventTypeMessageComplained MetricEventType = "message.complained"
	MetricEventTypeMessageReceived   MetricEventType = "message.received"
)

type MetricListParams

type MetricListParams struct {
	// Sort in descending order.
	Descending param.Opt[bool] `query:"descending,omitzero" json:"-"`
	// End timestamp for the query.
	End param.Opt[time.Time] `query:"end,omitzero" format:"date-time" json:"-"`
	// Limit on number of buckets to return.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Period in number of seconds for the query.
	Period param.Opt[string] `query:"period,omitzero" json:"-"`
	// Start timestamp for the query.
	Start param.Opt[time.Time] `query:"start,omitzero" format:"date-time" json:"-"`
	// List of metric event types to query.
	EventTypes []MetricEventType `query:"event_types,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (MetricListParams) URLQuery

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

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

type MetricListResponse added in v0.2.0

type MetricListResponse map[string][]MetricListResponseItem

type MetricListResponseItem added in v0.2.0

type MetricListResponseItem struct {
	// Count of events in the bucket.
	Count int64 `json:"count" api:"required"`
	// Timestamp of the bucket.
	Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Timestamp   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MetricListResponseItem) RawJSON added in v0.2.0

func (r MetricListResponseItem) RawJSON() string

Returns the unmodified JSON received from the API

func (*MetricListResponseItem) UnmarshalJSON added in v0.2.0

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

type MetricService

type MetricService struct {
	Options []option.RequestOption
}

MetricService contains methods and other services that help with interacting with the agentmail 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 NewMetricService method instead.

func NewMetricService

func NewMetricService(opts ...option.RequestOption) (r MetricService)

NewMetricService 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 (*MetricService) List

func (r *MetricService) List(ctx context.Context, query MetricListParams, opts ...option.RequestOption) (res *MetricListResponse, err error)

**CLI:**

```bash agentmail metrics list ```

type OrganizationGetResponse

type OrganizationGetResponse struct {
	// Time at which organization was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Current number of domains.
	DomainCount int64 `json:"domain_count" api:"required"`
	// Current number of inboxes.
	InboxCount int64 `json:"inbox_count" api:"required"`
	// ID of organization.
	OrganizationID string `json:"organization_id" api:"required"`
	// Time at which organization was last updated.
	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
	// Provider-agnostic authentication ID.
	AuthenticationID string `json:"authentication_id" api:"nullable"`
	// Authentication provider type.
	AuthenticationType string `json:"authentication_type" api:"nullable"`
	// Provider-agnostic billing customer ID.
	BillingID string `json:"billing_id" api:"nullable"`
	// Active billing subscription ID.
	BillingSubscriptionID string `json:"billing_subscription_id" api:"nullable"`
	// Billing provider type (e.g. "stripe").
	BillingType string `json:"billing_type" api:"nullable"`
	// Maximum number of domains allowed.
	DomainLimit int64 `json:"domain_limit" api:"nullable"`
	// Maximum number of inboxes allowed.
	InboxLimit int64 `json:"inbox_limit" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt             respjson.Field
		DomainCount           respjson.Field
		InboxCount            respjson.Field
		OrganizationID        respjson.Field
		UpdatedAt             respjson.Field
		AuthenticationID      respjson.Field
		AuthenticationType    respjson.Field
		BillingID             respjson.Field
		BillingSubscriptionID respjson.Field
		BillingType           respjson.Field
		DomainLimit           respjson.Field
		InboxLimit            respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Organization details with usage limits and counts.

func (OrganizationGetResponse) RawJSON

func (r OrganizationGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*OrganizationGetResponse) UnmarshalJSON

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

type OrganizationService

type OrganizationService struct {
	Options []option.RequestOption
}

OrganizationService contains methods and other services that help with interacting with the agentmail 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 NewOrganizationService method instead.

func NewOrganizationService

func NewOrganizationService(opts ...option.RequestOption) (r OrganizationService)

NewOrganizationService 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 (*OrganizationService) Get

Returns the organization for the authenticated API key (usage limits, counts, and billing metadata).

**CLI:**

```bash agentmail organizations get ```

type Pod

type Pod struct {
	// Time at which pod was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Name of pod.
	Name string `json:"name" api:"required"`
	// ID of pod.
	PodID string `json:"pod_id" api:"required"`
	// Time at which pod was last updated.
	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
	// Client ID of pod.
	ClientID string `json:"client_id" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Name        respjson.Field
		PodID       respjson.Field
		UpdatedAt   respjson.Field
		ClientID    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Pod) RawJSON

func (r Pod) RawJSON() string

Returns the unmodified JSON received from the API

func (*Pod) UnmarshalJSON

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

type PodAPIKeyDeleteParams added in v0.4.0

type PodAPIKeyDeleteParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type PodAPIKeyListParams added in v0.4.0

type PodAPIKeyListParams struct {
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PodAPIKeyListParams) URLQuery added in v0.4.0

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

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

type PodAPIKeyListResponse added in v0.4.0

type PodAPIKeyListResponse struct {
	// Ordered by `created_at` descending.
	APIKeys []PodAPIKeyListResponseAPIKey `json:"api_keys" api:"required"`
	// Number of items returned.
	Count int64 `json:"count" api:"required"`
	// Page token for pagination.
	NextPageToken string `json:"next_page_token" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKeys       respjson.Field
		Count         respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PodAPIKeyListResponse) RawJSON added in v0.4.0

func (r PodAPIKeyListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PodAPIKeyListResponse) UnmarshalJSON added in v0.4.0

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

type PodAPIKeyListResponseAPIKey added in v0.4.0

type PodAPIKeyListResponseAPIKey struct {
	// ID of api key.
	APIKeyID string `json:"api_key_id" api:"required"`
	// Time at which api key was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Name of api key.
	Name string `json:"name" api:"required"`
	// Prefix of api key.
	Prefix string `json:"prefix" api:"required"`
	// Inbox ID the api key is scoped to. If set, the key can only access resources
	// within this inbox.
	InboxID string `json:"inbox_id" api:"nullable"`
	// Granular permissions for the API key. When ommitted all permissions are granted.
	// Otherwise, only permissions set to true are granted.
	Permissions PodAPIKeyListResponseAPIKeyPermissions `json:"permissions" api:"nullable"`
	// Pod ID the api key is scoped to. If set, the key can only access resources
	// within this pod.
	PodID string `json:"pod_id" api:"nullable"`
	// Time at which api key was last used.
	UsedAt time.Time `json:"used_at" api:"nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKeyID    respjson.Field
		CreatedAt   respjson.Field
		Name        respjson.Field
		Prefix      respjson.Field
		InboxID     respjson.Field
		Permissions respjson.Field
		PodID       respjson.Field
		UsedAt      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PodAPIKeyListResponseAPIKey) RawJSON added in v0.4.0

func (r PodAPIKeyListResponseAPIKey) RawJSON() string

Returns the unmodified JSON received from the API

func (*PodAPIKeyListResponseAPIKey) UnmarshalJSON added in v0.4.0

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

type PodAPIKeyListResponseAPIKeyPermissions added in v0.4.0

type PodAPIKeyListResponseAPIKeyPermissions struct {
	// Create API keys.
	APIKeyCreate bool `json:"api_key_create" api:"nullable"`
	// Delete API keys.
	APIKeyDelete bool `json:"api_key_delete" api:"nullable"`
	// Read API keys.
	APIKeyRead bool `json:"api_key_read" api:"nullable"`
	// Create domains.
	DomainCreate bool `json:"domain_create" api:"nullable"`
	// Delete domains.
	DomainDelete bool `json:"domain_delete" api:"nullable"`
	// Read domain details.
	DomainRead bool `json:"domain_read" api:"nullable"`
	// Update domains.
	DomainUpdate bool `json:"domain_update" api:"nullable"`
	// Create drafts.
	DraftCreate bool `json:"draft_create" api:"nullable"`
	// Delete drafts.
	DraftDelete bool `json:"draft_delete" api:"nullable"`
	// Read drafts.
	DraftRead bool `json:"draft_read" api:"nullable"`
	// Send drafts.
	DraftSend bool `json:"draft_send" api:"nullable"`
	// Update drafts.
	DraftUpdate bool `json:"draft_update" api:"nullable"`
	// Create new inboxes.
	InboxCreate bool `json:"inbox_create" api:"nullable"`
	// Delete inboxes.
	InboxDelete bool `json:"inbox_delete" api:"nullable"`
	// Read inbox details.
	InboxRead bool `json:"inbox_read" api:"nullable"`
	// Update inbox settings.
	InboxUpdate bool `json:"inbox_update" api:"nullable"`
	// Access messages labeled blocked.
	LabelBlockedRead bool `json:"label_blocked_read" api:"nullable"`
	// Access messages labeled spam.
	LabelSpamRead bool `json:"label_spam_read" api:"nullable"`
	// Access messages labeled trash.
	LabelTrashRead bool `json:"label_trash_read" api:"nullable"`
	// Create list entries.
	ListEntryCreate bool `json:"list_entry_create" api:"nullable"`
	// Delete list entries.
	ListEntryDelete bool `json:"list_entry_delete" api:"nullable"`
	// Read list entries.
	ListEntryRead bool `json:"list_entry_read" api:"nullable"`
	// Read messages.
	MessageRead bool `json:"message_read" api:"nullable"`
	// Send messages.
	MessageSend bool `json:"message_send" api:"nullable"`
	// Update message labels.
	MessageUpdate bool `json:"message_update" api:"nullable"`
	// Read metrics.
	MetricsRead bool `json:"metrics_read" api:"nullable"`
	// Create pods.
	PodCreate bool `json:"pod_create" api:"nullable"`
	// Delete pods.
	PodDelete bool `json:"pod_delete" api:"nullable"`
	// Read pods.
	PodRead bool `json:"pod_read" api:"nullable"`
	// Delete threads.
	ThreadDelete bool `json:"thread_delete" api:"nullable"`
	// Read threads.
	ThreadRead bool `json:"thread_read" api:"nullable"`
	// Create webhooks.
	WebhookCreate bool `json:"webhook_create" api:"nullable"`
	// Delete webhooks.
	WebhookDelete bool `json:"webhook_delete" api:"nullable"`
	// Read webhook configurations.
	WebhookRead bool `json:"webhook_read" api:"nullable"`
	// Update webhooks.
	WebhookUpdate bool `json:"webhook_update" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKeyCreate     respjson.Field
		APIKeyDelete     respjson.Field
		APIKeyRead       respjson.Field
		DomainCreate     respjson.Field
		DomainDelete     respjson.Field
		DomainRead       respjson.Field
		DomainUpdate     respjson.Field
		DraftCreate      respjson.Field
		DraftDelete      respjson.Field
		DraftRead        respjson.Field
		DraftSend        respjson.Field
		DraftUpdate      respjson.Field
		InboxCreate      respjson.Field
		InboxDelete      respjson.Field
		InboxRead        respjson.Field
		InboxUpdate      respjson.Field
		LabelBlockedRead respjson.Field
		LabelSpamRead    respjson.Field
		LabelTrashRead   respjson.Field
		ListEntryCreate  respjson.Field
		ListEntryDelete  respjson.Field
		ListEntryRead    respjson.Field
		MessageRead      respjson.Field
		MessageSend      respjson.Field
		MessageUpdate    respjson.Field
		MetricsRead      respjson.Field
		PodCreate        respjson.Field
		PodDelete        respjson.Field
		PodRead          respjson.Field
		ThreadDelete     respjson.Field
		ThreadRead       respjson.Field
		WebhookCreate    respjson.Field
		WebhookDelete    respjson.Field
		WebhookRead      respjson.Field
		WebhookUpdate    respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Granular permissions for the API key. When ommitted all permissions are granted. Otherwise, only permissions set to true are granted.

func (PodAPIKeyListResponseAPIKeyPermissions) RawJSON added in v0.4.0

Returns the unmodified JSON received from the API

func (*PodAPIKeyListResponseAPIKeyPermissions) UnmarshalJSON added in v0.4.0

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

type PodAPIKeyNewParams added in v0.4.0

type PodAPIKeyNewParams struct {
	// Name of api key.
	Name param.Opt[string] `json:"name,omitzero"`
	// Granular permissions for the API key. When ommitted all permissions are granted.
	// Otherwise, only permissions set to true are granted.
	Permissions PodAPIKeyNewParamsPermissions `json:"permissions,omitzero"`
	// contains filtered or unexported fields
}

func (PodAPIKeyNewParams) MarshalJSON added in v0.4.0

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

func (*PodAPIKeyNewParams) UnmarshalJSON added in v0.4.0

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

type PodAPIKeyNewParamsPermissions added in v0.4.0

type PodAPIKeyNewParamsPermissions struct {
	// Create API keys.
	APIKeyCreate param.Opt[bool] `json:"api_key_create,omitzero"`
	// Delete API keys.
	APIKeyDelete param.Opt[bool] `json:"api_key_delete,omitzero"`
	// Read API keys.
	APIKeyRead param.Opt[bool] `json:"api_key_read,omitzero"`
	// Create domains.
	DomainCreate param.Opt[bool] `json:"domain_create,omitzero"`
	// Delete domains.
	DomainDelete param.Opt[bool] `json:"domain_delete,omitzero"`
	// Read domain details.
	DomainRead param.Opt[bool] `json:"domain_read,omitzero"`
	// Update domains.
	DomainUpdate param.Opt[bool] `json:"domain_update,omitzero"`
	// Create drafts.
	DraftCreate param.Opt[bool] `json:"draft_create,omitzero"`
	// Delete drafts.
	DraftDelete param.Opt[bool] `json:"draft_delete,omitzero"`
	// Read drafts.
	DraftRead param.Opt[bool] `json:"draft_read,omitzero"`
	// Send drafts.
	DraftSend param.Opt[bool] `json:"draft_send,omitzero"`
	// Update drafts.
	DraftUpdate param.Opt[bool] `json:"draft_update,omitzero"`
	// Create new inboxes.
	InboxCreate param.Opt[bool] `json:"inbox_create,omitzero"`
	// Delete inboxes.
	InboxDelete param.Opt[bool] `json:"inbox_delete,omitzero"`
	// Read inbox details.
	InboxRead param.Opt[bool] `json:"inbox_read,omitzero"`
	// Update inbox settings.
	InboxUpdate param.Opt[bool] `json:"inbox_update,omitzero"`
	// Access messages labeled blocked.
	LabelBlockedRead param.Opt[bool] `json:"label_blocked_read,omitzero"`
	// Access messages labeled spam.
	LabelSpamRead param.Opt[bool] `json:"label_spam_read,omitzero"`
	// Access messages labeled trash.
	LabelTrashRead param.Opt[bool] `json:"label_trash_read,omitzero"`
	// Create list entries.
	ListEntryCreate param.Opt[bool] `json:"list_entry_create,omitzero"`
	// Delete list entries.
	ListEntryDelete param.Opt[bool] `json:"list_entry_delete,omitzero"`
	// Read list entries.
	ListEntryRead param.Opt[bool] `json:"list_entry_read,omitzero"`
	// Read messages.
	MessageRead param.Opt[bool] `json:"message_read,omitzero"`
	// Send messages.
	MessageSend param.Opt[bool] `json:"message_send,omitzero"`
	// Update message labels.
	MessageUpdate param.Opt[bool] `json:"message_update,omitzero"`
	// Read metrics.
	MetricsRead param.Opt[bool] `json:"metrics_read,omitzero"`
	// Create pods.
	PodCreate param.Opt[bool] `json:"pod_create,omitzero"`
	// Delete pods.
	PodDelete param.Opt[bool] `json:"pod_delete,omitzero"`
	// Read pods.
	PodRead param.Opt[bool] `json:"pod_read,omitzero"`
	// Delete threads.
	ThreadDelete param.Opt[bool] `json:"thread_delete,omitzero"`
	// Read threads.
	ThreadRead param.Opt[bool] `json:"thread_read,omitzero"`
	// Create webhooks.
	WebhookCreate param.Opt[bool] `json:"webhook_create,omitzero"`
	// Delete webhooks.
	WebhookDelete param.Opt[bool] `json:"webhook_delete,omitzero"`
	// Read webhook configurations.
	WebhookRead param.Opt[bool] `json:"webhook_read,omitzero"`
	// Update webhooks.
	WebhookUpdate param.Opt[bool] `json:"webhook_update,omitzero"`
	// contains filtered or unexported fields
}

Granular permissions for the API key. When ommitted all permissions are granted. Otherwise, only permissions set to true are granted.

func (PodAPIKeyNewParamsPermissions) MarshalJSON added in v0.4.0

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

func (*PodAPIKeyNewParamsPermissions) UnmarshalJSON added in v0.4.0

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

type PodAPIKeyNewResponse added in v0.4.0

type PodAPIKeyNewResponse struct {
	// API key.
	APIKey string `json:"api_key" api:"required"`
	// ID of api key.
	APIKeyID string `json:"api_key_id" api:"required"`
	// Time at which api key was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Name of api key.
	Name string `json:"name" api:"required"`
	// Prefix of api key.
	Prefix string `json:"prefix" api:"required"`
	// Inbox ID the api key is scoped to.
	InboxID string `json:"inbox_id" api:"nullable"`
	// Granular permissions for the API key. When ommitted all permissions are granted.
	// Otherwise, only permissions set to true are granted.
	Permissions PodAPIKeyNewResponsePermissions `json:"permissions" api:"nullable"`
	// Pod ID the api key is scoped to.
	PodID string `json:"pod_id" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKey      respjson.Field
		APIKeyID    respjson.Field
		CreatedAt   respjson.Field
		Name        respjson.Field
		Prefix      respjson.Field
		InboxID     respjson.Field
		Permissions respjson.Field
		PodID       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PodAPIKeyNewResponse) RawJSON added in v0.4.0

func (r PodAPIKeyNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PodAPIKeyNewResponse) UnmarshalJSON added in v0.4.0

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

type PodAPIKeyNewResponsePermissions added in v0.4.0

type PodAPIKeyNewResponsePermissions struct {
	// Create API keys.
	APIKeyCreate bool `json:"api_key_create" api:"nullable"`
	// Delete API keys.
	APIKeyDelete bool `json:"api_key_delete" api:"nullable"`
	// Read API keys.
	APIKeyRead bool `json:"api_key_read" api:"nullable"`
	// Create domains.
	DomainCreate bool `json:"domain_create" api:"nullable"`
	// Delete domains.
	DomainDelete bool `json:"domain_delete" api:"nullable"`
	// Read domain details.
	DomainRead bool `json:"domain_read" api:"nullable"`
	// Update domains.
	DomainUpdate bool `json:"domain_update" api:"nullable"`
	// Create drafts.
	DraftCreate bool `json:"draft_create" api:"nullable"`
	// Delete drafts.
	DraftDelete bool `json:"draft_delete" api:"nullable"`
	// Read drafts.
	DraftRead bool `json:"draft_read" api:"nullable"`
	// Send drafts.
	DraftSend bool `json:"draft_send" api:"nullable"`
	// Update drafts.
	DraftUpdate bool `json:"draft_update" api:"nullable"`
	// Create new inboxes.
	InboxCreate bool `json:"inbox_create" api:"nullable"`
	// Delete inboxes.
	InboxDelete bool `json:"inbox_delete" api:"nullable"`
	// Read inbox details.
	InboxRead bool `json:"inbox_read" api:"nullable"`
	// Update inbox settings.
	InboxUpdate bool `json:"inbox_update" api:"nullable"`
	// Access messages labeled blocked.
	LabelBlockedRead bool `json:"label_blocked_read" api:"nullable"`
	// Access messages labeled spam.
	LabelSpamRead bool `json:"label_spam_read" api:"nullable"`
	// Access messages labeled trash.
	LabelTrashRead bool `json:"label_trash_read" api:"nullable"`
	// Create list entries.
	ListEntryCreate bool `json:"list_entry_create" api:"nullable"`
	// Delete list entries.
	ListEntryDelete bool `json:"list_entry_delete" api:"nullable"`
	// Read list entries.
	ListEntryRead bool `json:"list_entry_read" api:"nullable"`
	// Read messages.
	MessageRead bool `json:"message_read" api:"nullable"`
	// Send messages.
	MessageSend bool `json:"message_send" api:"nullable"`
	// Update message labels.
	MessageUpdate bool `json:"message_update" api:"nullable"`
	// Read metrics.
	MetricsRead bool `json:"metrics_read" api:"nullable"`
	// Create pods.
	PodCreate bool `json:"pod_create" api:"nullable"`
	// Delete pods.
	PodDelete bool `json:"pod_delete" api:"nullable"`
	// Read pods.
	PodRead bool `json:"pod_read" api:"nullable"`
	// Delete threads.
	ThreadDelete bool `json:"thread_delete" api:"nullable"`
	// Read threads.
	ThreadRead bool `json:"thread_read" api:"nullable"`
	// Create webhooks.
	WebhookCreate bool `json:"webhook_create" api:"nullable"`
	// Delete webhooks.
	WebhookDelete bool `json:"webhook_delete" api:"nullable"`
	// Read webhook configurations.
	WebhookRead bool `json:"webhook_read" api:"nullable"`
	// Update webhooks.
	WebhookUpdate bool `json:"webhook_update" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKeyCreate     respjson.Field
		APIKeyDelete     respjson.Field
		APIKeyRead       respjson.Field
		DomainCreate     respjson.Field
		DomainDelete     respjson.Field
		DomainRead       respjson.Field
		DomainUpdate     respjson.Field
		DraftCreate      respjson.Field
		DraftDelete      respjson.Field
		DraftRead        respjson.Field
		DraftSend        respjson.Field
		DraftUpdate      respjson.Field
		InboxCreate      respjson.Field
		InboxDelete      respjson.Field
		InboxRead        respjson.Field
		InboxUpdate      respjson.Field
		LabelBlockedRead respjson.Field
		LabelSpamRead    respjson.Field
		LabelTrashRead   respjson.Field
		ListEntryCreate  respjson.Field
		ListEntryDelete  respjson.Field
		ListEntryRead    respjson.Field
		MessageRead      respjson.Field
		MessageSend      respjson.Field
		MessageUpdate    respjson.Field
		MetricsRead      respjson.Field
		PodCreate        respjson.Field
		PodDelete        respjson.Field
		PodRead          respjson.Field
		ThreadDelete     respjson.Field
		ThreadRead       respjson.Field
		WebhookCreate    respjson.Field
		WebhookDelete    respjson.Field
		WebhookRead      respjson.Field
		WebhookUpdate    respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Granular permissions for the API key. When ommitted all permissions are granted. Otherwise, only permissions set to true are granted.

func (PodAPIKeyNewResponsePermissions) RawJSON added in v0.4.0

Returns the unmodified JSON received from the API

func (*PodAPIKeyNewResponsePermissions) UnmarshalJSON added in v0.4.0

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

type PodAPIKeyService added in v0.4.0

type PodAPIKeyService struct {
	Options []option.RequestOption
}

PodAPIKeyService contains methods and other services that help with interacting with the agentmail 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 NewPodAPIKeyService method instead.

func NewPodAPIKeyService added in v0.4.0

func NewPodAPIKeyService(opts ...option.RequestOption) (r PodAPIKeyService)

NewPodAPIKeyService 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 (*PodAPIKeyService) Delete added in v0.4.0

func (r *PodAPIKeyService) Delete(ctx context.Context, apiKeyID string, body PodAPIKeyDeleteParams, opts ...option.RequestOption) (err error)

**CLI:**

```bash agentmail pods:api-keys delete --pod-id <pod_id> --api-key-id <api_key_id> ```

func (*PodAPIKeyService) List added in v0.4.0

**CLI:**

```bash agentmail pods:api-keys list --pod-id <pod_id> ```

func (*PodAPIKeyService) New added in v0.4.0

**CLI:**

```bash agentmail pods:api-keys create --pod-id <pod_id> --name "My Key" ```

type PodDomainDeleteParams

type PodDomainDeleteParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type PodDomainGetParams added in v0.4.0

type PodDomainGetParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type PodDomainGetZoneFileParams added in v0.4.0

type PodDomainGetZoneFileParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type PodDomainListParams

type PodDomainListParams struct {
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PodDomainListParams) URLQuery

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

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

type PodDomainNewParams

type PodDomainNewParams struct {
	CreateDomain CreateDomainParam
	// contains filtered or unexported fields
}

func (PodDomainNewParams) MarshalJSON

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

func (*PodDomainNewParams) UnmarshalJSON

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

type PodDomainService

type PodDomainService struct {
	Options []option.RequestOption
}

PodDomainService contains methods and other services that help with interacting with the agentmail 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 NewPodDomainService method instead.

func NewPodDomainService

func NewPodDomainService(opts ...option.RequestOption) (r PodDomainService)

NewPodDomainService 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 (*PodDomainService) Delete

func (r *PodDomainService) Delete(ctx context.Context, domainID string, body PodDomainDeleteParams, opts ...option.RequestOption) (err error)

**CLI:**

```bash agentmail pods:domains delete --pod-id <pod_id> --domain-id <domain_id> ```

func (*PodDomainService) Get added in v0.4.0

func (r *PodDomainService) Get(ctx context.Context, domainID string, query PodDomainGetParams, opts ...option.RequestOption) (res *Domain, err error)

**CLI:**

```bash agentmail pods:domains get --pod-id <pod_id> --domain-id <domain_id> ```

func (*PodDomainService) GetZoneFile added in v0.4.0

func (r *PodDomainService) GetZoneFile(ctx context.Context, domainID string, query PodDomainGetZoneFileParams, opts ...option.RequestOption) (err error)

**CLI:**

```bash agentmail pods:domains get-zone-file --pod-id <pod_id> --domain-id <domain_id> ```

func (*PodDomainService) List

func (r *PodDomainService) List(ctx context.Context, podID string, query PodDomainListParams, opts ...option.RequestOption) (res *ListDomains, err error)

**CLI:**

```bash agentmail pods:domains list --pod-id <pod_id> ```

func (*PodDomainService) New

func (r *PodDomainService) New(ctx context.Context, podID string, body PodDomainNewParams, opts ...option.RequestOption) (res *Domain, err error)

**CLI:**

```bash agentmail pods:domains create --pod-id <pod_id> --domain example.com ```

func (*PodDomainService) Update added in v0.4.0

func (r *PodDomainService) Update(ctx context.Context, domainID string, params PodDomainUpdateParams, opts ...option.RequestOption) (res *Domain, err error)

**CLI:**

```bash agentmail pods:domains update --pod-id <pod_id> --domain-id <domain_id> ```

func (*PodDomainService) Verify added in v0.4.0

func (r *PodDomainService) Verify(ctx context.Context, domainID string, body PodDomainVerifyParams, opts ...option.RequestOption) (err error)

**CLI:**

```bash agentmail pods:domains verify --pod-id <pod_id> --domain-id <domain_id> ```

type PodDomainUpdateParams added in v0.4.0

type PodDomainUpdateParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// Bounce and complaint notifications are sent to your inboxes.
	FeedbackEnabled param.Opt[bool] `json:"feedback_enabled,omitzero"`
	// contains filtered or unexported fields
}

func (PodDomainUpdateParams) MarshalJSON added in v0.4.0

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

func (*PodDomainUpdateParams) UnmarshalJSON added in v0.4.0

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

type PodDomainVerifyParams added in v0.4.0

type PodDomainVerifyParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type PodDraftGetAttachmentParams added in v0.4.0

type PodDraftGetAttachmentParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// ID of draft.
	DraftID string `path:"draft_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type PodDraftGetParams

type PodDraftGetParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type PodDraftListParams

type PodDraftListParams struct {
	// Timestamp after which to filter by.
	After param.Opt[time.Time] `query:"after,omitzero" format:"date-time" json:"-"`
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Timestamp before which to filter by.
	Before param.Opt[time.Time] `query:"before,omitzero" format:"date-time" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// Labels to filter by.
	Labels []string `query:"labels,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PodDraftListParams) URLQuery

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

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

type PodDraftService

type PodDraftService struct {
	Options []option.RequestOption
}

PodDraftService contains methods and other services that help with interacting with the agentmail 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 NewPodDraftService method instead.

func NewPodDraftService

func NewPodDraftService(opts ...option.RequestOption) (r PodDraftService)

NewPodDraftService 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 (*PodDraftService) Get

func (r *PodDraftService) Get(ctx context.Context, draftID string, query PodDraftGetParams, opts ...option.RequestOption) (res *Draft, err error)

**CLI:**

```bash agentmail pods:drafts get --pod-id <pod_id> --draft-id <draft_id> ```

func (*PodDraftService) GetAttachment added in v0.4.0

func (r *PodDraftService) GetAttachment(ctx context.Context, attachmentID string, query PodDraftGetAttachmentParams, opts ...option.RequestOption) (res *AttachmentResponse, err error)

**CLI:**

```bash agentmail pods:drafts get-attachment --pod-id <pod_id> --draft-id <draft_id> --attachment-id <attachment_id> ```

func (*PodDraftService) List

func (r *PodDraftService) List(ctx context.Context, podID string, query PodDraftListParams, opts ...option.RequestOption) (res *ListDrafts, err error)

**CLI:**

```bash agentmail pods:drafts list --pod-id <pod_id> ```

type PodInboxDeleteParams

type PodInboxDeleteParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type PodInboxGetParams

type PodInboxGetParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type PodInboxListParams

type PodInboxListParams struct {
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PodInboxListParams) URLQuery

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

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

type PodInboxNewParams

type PodInboxNewParams struct {
	CreateInbox CreateInboxParam
	// contains filtered or unexported fields
}

func (PodInboxNewParams) MarshalJSON

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

func (*PodInboxNewParams) UnmarshalJSON

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

type PodInboxService

type PodInboxService struct {
	Options []option.RequestOption
}

PodInboxService contains methods and other services that help with interacting with the agentmail 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 NewPodInboxService method instead.

func NewPodInboxService

func NewPodInboxService(opts ...option.RequestOption) (r PodInboxService)

NewPodInboxService 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 (*PodInboxService) Delete

func (r *PodInboxService) Delete(ctx context.Context, inboxID string, body PodInboxDeleteParams, opts ...option.RequestOption) (err error)

**CLI:**

```bash agentmail pods:inboxes delete --pod-id <pod_id> --inbox-id <inbox_id> ```

func (*PodInboxService) Get

func (r *PodInboxService) Get(ctx context.Context, inboxID string, query PodInboxGetParams, opts ...option.RequestOption) (res *Inbox, err error)

**CLI:**

```bash agentmail pods:inboxes get --pod-id <pod_id> --inbox-id <inbox_id> ```

func (*PodInboxService) List

func (r *PodInboxService) List(ctx context.Context, podID string, query PodInboxListParams, opts ...option.RequestOption) (res *ListInboxes, err error)

**CLI:**

```bash agentmail pods:inboxes list --pod-id <pod_id> ```

func (*PodInboxService) New

func (r *PodInboxService) New(ctx context.Context, podID string, body PodInboxNewParams, opts ...option.RequestOption) (res *Inbox, err error)

**CLI:**

```bash agentmail pods:inboxes create --pod-id <pod_id> --username myagent --domain example.com ```

func (*PodInboxService) Update added in v0.4.0

func (r *PodInboxService) Update(ctx context.Context, inboxID string, params PodInboxUpdateParams, opts ...option.RequestOption) (res *Inbox, err error)

**CLI:**

```bash agentmail pods:inboxes update --pod-id <pod_id> --inbox-id <inbox_id> ```

type PodInboxUpdateParams added in v0.4.0

type PodInboxUpdateParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// Display name: `Display Name <username@domain.com>`.
	DisplayName string `json:"display_name" api:"required"`
	// contains filtered or unexported fields
}

func (PodInboxUpdateParams) MarshalJSON added in v0.4.0

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

func (*PodInboxUpdateParams) UnmarshalJSON added in v0.4.0

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

type PodListDeleteParams added in v0.4.0

type PodListDeleteParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction PodListDeleteParamsDirection `path:"direction,omitzero" api:"required" json:"-"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	Type PodListDeleteParamsType `path:"type,omitzero" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type PodListDeleteParamsDirection added in v0.4.0

type PodListDeleteParamsDirection string

Direction of list entry.

const (
	PodListDeleteParamsDirectionSend    PodListDeleteParamsDirection = "send"
	PodListDeleteParamsDirectionReceive PodListDeleteParamsDirection = "receive"
	PodListDeleteParamsDirectionReply   PodListDeleteParamsDirection = "reply"
)

type PodListDeleteParamsType added in v0.4.0

type PodListDeleteParamsType string

Type of list entry.

const (
	PodListDeleteParamsTypeAllow PodListDeleteParamsType = "allow"
	PodListDeleteParamsTypeBlock PodListDeleteParamsType = "block"
)

type PodListGetParams added in v0.4.0

type PodListGetParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction PodListGetParamsDirection `path:"direction,omitzero" api:"required" json:"-"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	Type PodListGetParamsType `path:"type,omitzero" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type PodListGetParamsDirection added in v0.4.0

type PodListGetParamsDirection string

Direction of list entry.

const (
	PodListGetParamsDirectionSend    PodListGetParamsDirection = "send"
	PodListGetParamsDirectionReceive PodListGetParamsDirection = "receive"
	PodListGetParamsDirectionReply   PodListGetParamsDirection = "reply"
)

type PodListGetParamsType added in v0.4.0

type PodListGetParamsType string

Type of list entry.

const (
	PodListGetParamsTypeAllow PodListGetParamsType = "allow"
	PodListGetParamsTypeBlock PodListGetParamsType = "block"
)

type PodListGetResponse added in v0.4.0

type PodListGetResponse struct {
	// Time at which entry was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction PodListGetResponseDirection `json:"direction" api:"required"`
	// Email address or domain of list entry.
	Entry string `json:"entry" api:"required"`
	// Whether the entry is an email address or domain.
	//
	// Any of "email", "domain".
	EntryType PodListGetResponseEntryType `json:"entry_type" api:"required"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	ListType PodListGetResponseListType `json:"list_type" api:"required"`
	// ID of organization.
	OrganizationID string `json:"organization_id" api:"required"`
	// ID of pod.
	PodID string `json:"pod_id" api:"required"`
	// ID of inbox, if entry is inbox-scoped.
	InboxID string `json:"inbox_id" api:"nullable"`
	// Reason for adding the entry.
	Reason string `json:"reason" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt      respjson.Field
		Direction      respjson.Field
		Entry          respjson.Field
		EntryType      respjson.Field
		ListType       respjson.Field
		OrganizationID respjson.Field
		PodID          respjson.Field
		InboxID        respjson.Field
		Reason         respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PodListGetResponse) RawJSON added in v0.4.0

func (r PodListGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PodListGetResponse) UnmarshalJSON added in v0.4.0

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

type PodListGetResponseDirection added in v0.4.0

type PodListGetResponseDirection string

Direction of list entry.

const (
	PodListGetResponseDirectionSend    PodListGetResponseDirection = "send"
	PodListGetResponseDirectionReceive PodListGetResponseDirection = "receive"
	PodListGetResponseDirectionReply   PodListGetResponseDirection = "reply"
)

type PodListGetResponseEntryType added in v0.4.0

type PodListGetResponseEntryType string

Whether the entry is an email address or domain.

const (
	PodListGetResponseEntryTypeEmail  PodListGetResponseEntryType = "email"
	PodListGetResponseEntryTypeDomain PodListGetResponseEntryType = "domain"
)

type PodListGetResponseListType added in v0.4.0

type PodListGetResponseListType string

Type of list entry.

const (
	PodListGetResponseListTypeAllow PodListGetResponseListType = "allow"
	PodListGetResponseListTypeBlock PodListGetResponseListType = "block"
)

type PodListListParams added in v0.4.0

type PodListListParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction PodListListParamsDirection `path:"direction,omitzero" api:"required" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PodListListParams) URLQuery added in v0.4.0

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

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

type PodListListParamsDirection added in v0.4.0

type PodListListParamsDirection string

Direction of list entry.

const (
	PodListListParamsDirectionSend    PodListListParamsDirection = "send"
	PodListListParamsDirectionReceive PodListListParamsDirection = "receive"
	PodListListParamsDirectionReply   PodListListParamsDirection = "reply"
)

type PodListListParamsType added in v0.4.0

type PodListListParamsType string

Type of list entry.

const (
	PodListListParamsTypeAllow PodListListParamsType = "allow"
	PodListListParamsTypeBlock PodListListParamsType = "block"
)

type PodListListResponse added in v0.4.0

type PodListListResponse struct {
	// Number of items returned.
	Count int64 `json:"count" api:"required"`
	// Ordered by entry ascending.
	Entries []PodListListResponseEntry `json:"entries" api:"required"`
	// Limit of number of items returned.
	Limit int64 `json:"limit" api:"nullable"`
	// Page token for pagination.
	NextPageToken string `json:"next_page_token" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count         respjson.Field
		Entries       respjson.Field
		Limit         respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PodListListResponse) RawJSON added in v0.4.0

func (r PodListListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PodListListResponse) UnmarshalJSON added in v0.4.0

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

type PodListListResponseEntry added in v0.4.0

type PodListListResponseEntry struct {
	// Time at which entry was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction string `json:"direction" api:"required"`
	// Email address or domain of list entry.
	Entry string `json:"entry" api:"required"`
	// Whether the entry is an email address or domain.
	//
	// Any of "email", "domain".
	EntryType string `json:"entry_type" api:"required"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	ListType string `json:"list_type" api:"required"`
	// ID of organization.
	OrganizationID string `json:"organization_id" api:"required"`
	// ID of pod.
	PodID string `json:"pod_id" api:"required"`
	// ID of inbox, if entry is inbox-scoped.
	InboxID string `json:"inbox_id" api:"nullable"`
	// Reason for adding the entry.
	Reason string `json:"reason" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt      respjson.Field
		Direction      respjson.Field
		Entry          respjson.Field
		EntryType      respjson.Field
		ListType       respjson.Field
		OrganizationID respjson.Field
		PodID          respjson.Field
		InboxID        respjson.Field
		Reason         respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PodListListResponseEntry) RawJSON added in v0.4.0

func (r PodListListResponseEntry) RawJSON() string

Returns the unmodified JSON received from the API

func (*PodListListResponseEntry) UnmarshalJSON added in v0.4.0

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

type PodListNewParams added in v0.4.0

type PodListNewParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction PodListNewParamsDirection `path:"direction,omitzero" api:"required" json:"-"`
	// Email address or domain to add.
	Entry string `json:"entry" api:"required"`
	// Reason for adding the entry.
	Reason param.Opt[string] `json:"reason,omitzero"`
	// contains filtered or unexported fields
}

func (PodListNewParams) MarshalJSON added in v0.4.0

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

func (*PodListNewParams) UnmarshalJSON added in v0.4.0

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

type PodListNewParamsDirection added in v0.4.0

type PodListNewParamsDirection string

Direction of list entry.

const (
	PodListNewParamsDirectionSend    PodListNewParamsDirection = "send"
	PodListNewParamsDirectionReceive PodListNewParamsDirection = "receive"
	PodListNewParamsDirectionReply   PodListNewParamsDirection = "reply"
)

type PodListNewParamsType added in v0.4.0

type PodListNewParamsType string

Type of list entry.

const (
	PodListNewParamsTypeAllow PodListNewParamsType = "allow"
	PodListNewParamsTypeBlock PodListNewParamsType = "block"
)

type PodListNewResponse added in v0.4.0

type PodListNewResponse struct {
	// Time at which entry was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Direction of list entry.
	//
	// Any of "send", "receive", "reply".
	Direction PodListNewResponseDirection `json:"direction" api:"required"`
	// Email address or domain of list entry.
	Entry string `json:"entry" api:"required"`
	// Whether the entry is an email address or domain.
	//
	// Any of "email", "domain".
	EntryType PodListNewResponseEntryType `json:"entry_type" api:"required"`
	// Type of list entry.
	//
	// Any of "allow", "block".
	ListType PodListNewResponseListType `json:"list_type" api:"required"`
	// ID of organization.
	OrganizationID string `json:"organization_id" api:"required"`
	// ID of pod.
	PodID string `json:"pod_id" api:"required"`
	// ID of inbox, if entry is inbox-scoped.
	InboxID string `json:"inbox_id" api:"nullable"`
	// Reason for adding the entry.
	Reason string `json:"reason" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt      respjson.Field
		Direction      respjson.Field
		Entry          respjson.Field
		EntryType      respjson.Field
		ListType       respjson.Field
		OrganizationID respjson.Field
		PodID          respjson.Field
		InboxID        respjson.Field
		Reason         respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PodListNewResponse) RawJSON added in v0.4.0

func (r PodListNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PodListNewResponse) UnmarshalJSON added in v0.4.0

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

type PodListNewResponseDirection added in v0.4.0

type PodListNewResponseDirection string

Direction of list entry.

const (
	PodListNewResponseDirectionSend    PodListNewResponseDirection = "send"
	PodListNewResponseDirectionReceive PodListNewResponseDirection = "receive"
	PodListNewResponseDirectionReply   PodListNewResponseDirection = "reply"
)

type PodListNewResponseEntryType added in v0.4.0

type PodListNewResponseEntryType string

Whether the entry is an email address or domain.

const (
	PodListNewResponseEntryTypeEmail  PodListNewResponseEntryType = "email"
	PodListNewResponseEntryTypeDomain PodListNewResponseEntryType = "domain"
)

type PodListNewResponseListType added in v0.4.0

type PodListNewResponseListType string

Type of list entry.

const (
	PodListNewResponseListTypeAllow PodListNewResponseListType = "allow"
	PodListNewResponseListTypeBlock PodListNewResponseListType = "block"
)

type PodListParams

type PodListParams struct {
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PodListParams) URLQuery

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

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

type PodListResponse

type PodListResponse struct {
	// Number of items returned.
	Count int64 `json:"count" api:"required"`
	// Ordered by `created_at` descending.
	Pods []Pod `json:"pods" api:"required"`
	// Limit of number of items returned.
	Limit int64 `json:"limit" api:"nullable"`
	// Page token for pagination.
	NextPageToken string `json:"next_page_token" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count         respjson.Field
		Pods          respjson.Field
		Limit         respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PodListResponse) RawJSON

func (r PodListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PodListResponse) UnmarshalJSON

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

type PodListService added in v0.4.0

type PodListService struct {
	Options []option.RequestOption
}

PodListService contains methods and other services that help with interacting with the agentmail 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 NewPodListService method instead.

func NewPodListService added in v0.4.0

func NewPodListService(opts ...option.RequestOption) (r PodListService)

NewPodListService 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 (*PodListService) Delete added in v0.4.0

func (r *PodListService) Delete(ctx context.Context, entry string, body PodListDeleteParams, opts ...option.RequestOption) (err error)

**CLI:**

```bash agentmail pods:lists delete --pod-id <pod_id> --direction <direction> --type <type> --entry <entry> ```

func (*PodListService) Get added in v0.4.0

func (r *PodListService) Get(ctx context.Context, entry string, query PodListGetParams, opts ...option.RequestOption) (res *PodListGetResponse, err error)

**CLI:**

```bash agentmail pods:lists get --pod-id <pod_id> --direction <direction> --type <type> --entry <entry> ```

func (*PodListService) List added in v0.4.0

**CLI:**

```bash agentmail pods:lists list --pod-id <pod_id> --direction <direction> --type <type> ```

func (*PodListService) New added in v0.4.0

**CLI:**

```bash agentmail pods:lists create --pod-id <pod_id> --direction <direction> --type <type> --entry user@example.com ```

type PodMetricQueryParams added in v0.4.0

type PodMetricQueryParams struct {
	// Sort in descending order.
	Descending param.Opt[bool] `query:"descending,omitzero" json:"-"`
	// End timestamp for the query.
	End param.Opt[time.Time] `query:"end,omitzero" format:"date-time" json:"-"`
	// Limit on number of buckets to return.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Period in number of seconds for the query.
	Period param.Opt[string] `query:"period,omitzero" json:"-"`
	// Start timestamp for the query.
	Start param.Opt[time.Time] `query:"start,omitzero" format:"date-time" json:"-"`
	// List of metric event types to query.
	EventTypes []MetricEventType `query:"event_types,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PodMetricQueryParams) URLQuery added in v0.4.0

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

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

type PodMetricQueryResponse added in v0.4.0

type PodMetricQueryResponse map[string][]PodMetricQueryResponseItem

type PodMetricQueryResponseItem added in v0.4.0

type PodMetricQueryResponseItem struct {
	// Count of events in the bucket.
	Count int64 `json:"count" api:"required"`
	// Timestamp of the bucket.
	Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Timestamp   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PodMetricQueryResponseItem) RawJSON added in v0.4.0

func (r PodMetricQueryResponseItem) RawJSON() string

Returns the unmodified JSON received from the API

func (*PodMetricQueryResponseItem) UnmarshalJSON added in v0.4.0

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

type PodMetricService added in v0.4.0

type PodMetricService struct {
	Options []option.RequestOption
}

PodMetricService contains methods and other services that help with interacting with the agentmail 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 NewPodMetricService method instead.

func NewPodMetricService added in v0.4.0

func NewPodMetricService(opts ...option.RequestOption) (r PodMetricService)

NewPodMetricService 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 (*PodMetricService) Query added in v0.4.0

**CLI:**

```bash agentmail pods:metrics query --pod-id <pod_id> ```

type PodNewParams

type PodNewParams struct {
	// Client ID of pod.
	ClientID param.Opt[string] `json:"client_id,omitzero"`
	// Name of pod.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (PodNewParams) MarshalJSON

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

func (*PodNewParams) UnmarshalJSON

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

type PodService

type PodService struct {
	Options []option.RequestOption
	Domains PodDomainService
	Drafts  PodDraftService
	Inboxes PodInboxService
	Threads PodThreadService
	Lists   PodListService
	APIKeys PodAPIKeyService
	Metrics PodMetricService
}

PodService contains methods and other services that help with interacting with the agentmail 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 NewPodService method instead.

func NewPodService

func NewPodService(opts ...option.RequestOption) (r PodService)

NewPodService 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 (*PodService) Delete

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

**CLI:**

```bash agentmail pods delete --pod-id <pod_id> ```

func (*PodService) Get

func (r *PodService) Get(ctx context.Context, podID string, opts ...option.RequestOption) (res *Pod, err error)

**CLI:**

```bash agentmail pods get --pod-id <pod_id> ```

func (*PodService) List

func (r *PodService) List(ctx context.Context, query PodListParams, opts ...option.RequestOption) (res *PodListResponse, err error)

**CLI:**

```bash agentmail pods list ```

func (*PodService) New

func (r *PodService) New(ctx context.Context, body PodNewParams, opts ...option.RequestOption) (res *Pod, err error)

**CLI:**

```bash agentmail pods create --client-id my-pod ```

type PodThreadDeleteParams added in v0.4.0

type PodThreadDeleteParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// If true, permanently delete the thread instead of moving to trash.
	Permanent param.Opt[bool] `query:"permanent,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PodThreadDeleteParams) URLQuery added in v0.4.0

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

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

type PodThreadGetAttachmentParams

type PodThreadGetAttachmentParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// ID of thread.
	ThreadID string `path:"thread_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type PodThreadGetParams

type PodThreadGetParams struct {
	// ID of pod.
	PodID string `path:"pod_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type PodThreadListParams

type PodThreadListParams struct {
	// Timestamp after which to filter by.
	After param.Opt[time.Time] `query:"after,omitzero" format:"date-time" json:"-"`
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Timestamp before which to filter by.
	Before param.Opt[time.Time] `query:"before,omitzero" format:"date-time" json:"-"`
	// Include blocked in results.
	IncludeBlocked param.Opt[bool] `query:"include_blocked,omitzero" json:"-"`
	// Include spam in results.
	IncludeSpam param.Opt[bool] `query:"include_spam,omitzero" json:"-"`
	// Include trash in results.
	IncludeTrash param.Opt[bool] `query:"include_trash,omitzero" json:"-"`
	// Include unauthenticated in results.
	IncludeUnauthenticated param.Opt[bool] `query:"include_unauthenticated,omitzero" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// Labels to filter by.
	Labels []string `query:"labels,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PodThreadListParams) URLQuery

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

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

type PodThreadService

type PodThreadService struct {
	Options []option.RequestOption
}

PodThreadService contains methods and other services that help with interacting with the agentmail 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 NewPodThreadService method instead.

func NewPodThreadService

func NewPodThreadService(opts ...option.RequestOption) (r PodThreadService)

NewPodThreadService 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 (*PodThreadService) Delete added in v0.4.0

func (r *PodThreadService) Delete(ctx context.Context, threadID string, params PodThreadDeleteParams, opts ...option.RequestOption) (err error)

Moves the thread to trash by adding a trash label to all messages. If the thread is already in trash, it will be permanently deleted. Use `permanent=true` to force permanent deletion.

**CLI:**

```bash agentmail pods:threads delete --pod-id <pod_id> --thread-id <thread_id> ```

func (*PodThreadService) Get

func (r *PodThreadService) Get(ctx context.Context, threadID string, query PodThreadGetParams, opts ...option.RequestOption) (res *Thread, err error)

**CLI:**

```bash agentmail pods:threads get --pod-id <pod_id> --thread-id <thread_id> ```

func (*PodThreadService) GetAttachment

func (r *PodThreadService) GetAttachment(ctx context.Context, attachmentID string, query PodThreadGetAttachmentParams, opts ...option.RequestOption) (res *AttachmentResponse, err error)

**CLI:**

```bash agentmail pods:threads get-attachment --pod-id <pod_id> --thread-id <thread_id> --attachment-id <attachment_id> ```

func (*PodThreadService) List

func (r *PodThreadService) List(ctx context.Context, podID string, query PodThreadListParams, opts ...option.RequestOption) (res *ListThreads, err error)

**CLI:**

```bash agentmail pods:threads list --pod-id <pod_id> ```

type SendAttachmentParam

type SendAttachmentParam struct {
	// Base64 encoded content of attachment.
	Content param.Opt[string] `json:"content,omitzero"`
	// Content ID of attachment.
	ContentID param.Opt[string] `json:"content_id,omitzero"`
	// Content type of attachment.
	ContentType param.Opt[string] `json:"content_type,omitzero"`
	// Filename of attachment.
	Filename param.Opt[string] `json:"filename,omitzero"`
	// URL to the attachment.
	URL param.Opt[string] `json:"url,omitzero"`
	// Content disposition of attachment.
	//
	// Any of "inline", "attachment".
	ContentDisposition AttachmentContentDisposition `json:"content_disposition,omitzero"`
	// contains filtered or unexported fields
}

func (SendAttachmentParam) MarshalJSON

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

func (*SendAttachmentParam) UnmarshalJSON

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

type SendMessageRequestParam

type SendMessageRequestParam struct {
	// HTML body of message.
	HTML param.Opt[string] `json:"html,omitzero"`
	// Subject of message.
	Subject param.Opt[string] `json:"subject,omitzero"`
	// Plain text body of message.
	Text param.Opt[string] `json:"text,omitzero"`
	// Attachments to include in message.
	Attachments []SendAttachmentParam `json:"attachments,omitzero"`
	// Headers to include in message.
	Headers map[string]string `json:"headers,omitzero"`
	// Labels of message.
	Labels []string `json:"labels,omitzero"`
	// BCC recipient address or addresses.
	Bcc AddressesUnionParam `json:"bcc,omitzero"`
	// CC recipient address or addresses.
	Cc AddressesUnionParam `json:"cc,omitzero"`
	// Reply-to address or addresses.
	ReplyTo AddressesUnionParam `json:"reply_to,omitzero"`
	// Recipient address or addresses.
	To AddressesUnionParam `json:"to,omitzero"`
	// contains filtered or unexported fields
}

func (SendMessageRequestParam) MarshalJSON

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

func (*SendMessageRequestParam) UnmarshalJSON

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

type SendMessageResponse

type SendMessageResponse struct {
	// ID of message.
	MessageID string `json:"message_id" api:"required"`
	// ID of thread.
	ThreadID string `json:"thread_id" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MessageID   respjson.Field
		ThreadID    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SendMessageResponse) RawJSON

func (r SendMessageResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SendMessageResponse) UnmarshalJSON

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

type Thread

type Thread struct {
	// Time at which thread was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// The ID of the inbox.
	InboxID string `json:"inbox_id" api:"required"`
	// Labels of thread.
	Labels []string `json:"labels" api:"required"`
	// ID of last message in thread.
	LastMessageID string `json:"last_message_id" api:"required"`
	// Number of messages in thread.
	MessageCount int64 `json:"message_count" api:"required"`
	// Messages in thread. Ordered by `timestamp` ascending.
	Messages []Message `json:"messages" api:"required"`
	// Recipients in thread. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Recipients []string `json:"recipients" api:"required"`
	// Senders in thread. In format `username@domain.com` or
	// `Display Name <username@domain.com>`.
	Senders []string `json:"senders" api:"required"`
	// Size of thread in bytes.
	Size int64 `json:"size" api:"required"`
	// ID of thread.
	ThreadID string `json:"thread_id" api:"required"`
	// Timestamp of last sent or received message.
	Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"`
	// Time at which thread was last updated.
	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
	// Attachments in thread.
	Attachments []AttachmentFile `json:"attachments" api:"nullable"`
	// Text preview of last message in thread.
	Preview string `json:"preview" api:"nullable"`
	// Timestamp of last received message.
	ReceivedTimestamp time.Time `json:"received_timestamp" api:"nullable" format:"date-time"`
	// Timestamp of last sent message.
	SentTimestamp time.Time `json:"sent_timestamp" api:"nullable" format:"date-time"`
	// Subject of thread.
	Subject string `json:"subject" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt         respjson.Field
		InboxID           respjson.Field
		Labels            respjson.Field
		LastMessageID     respjson.Field
		MessageCount      respjson.Field
		Messages          respjson.Field
		Recipients        respjson.Field
		Senders           respjson.Field
		Size              respjson.Field
		ThreadID          respjson.Field
		Timestamp         respjson.Field
		UpdatedAt         respjson.Field
		Attachments       respjson.Field
		Preview           respjson.Field
		ReceivedTimestamp respjson.Field
		SentTimestamp     respjson.Field
		Subject           respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Thread) RawJSON

func (r Thread) RawJSON() string

Returns the unmodified JSON received from the API

func (*Thread) UnmarshalJSON

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

type ThreadDeleteParams added in v0.4.0

type ThreadDeleteParams struct {
	// If true, permanently delete the thread instead of moving to trash.
	Permanent param.Opt[bool] `query:"permanent,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ThreadDeleteParams) URLQuery added in v0.4.0

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

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

type ThreadGetAttachmentParams

type ThreadGetAttachmentParams struct {
	// ID of thread.
	ThreadID string `path:"thread_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type ThreadListParams

type ThreadListParams struct {
	// Timestamp after which to filter by.
	After param.Opt[time.Time] `query:"after,omitzero" format:"date-time" json:"-"`
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Timestamp before which to filter by.
	Before param.Opt[time.Time] `query:"before,omitzero" format:"date-time" json:"-"`
	// Include blocked in results.
	IncludeBlocked param.Opt[bool] `query:"include_blocked,omitzero" json:"-"`
	// Include spam in results.
	IncludeSpam param.Opt[bool] `query:"include_spam,omitzero" json:"-"`
	// Include trash in results.
	IncludeTrash param.Opt[bool] `query:"include_trash,omitzero" json:"-"`
	// Include unauthenticated in results.
	IncludeUnauthenticated param.Opt[bool] `query:"include_unauthenticated,omitzero" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// Labels to filter by.
	Labels []string `query:"labels,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ThreadListParams) URLQuery

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

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

type ThreadService

type ThreadService struct {
	Options []option.RequestOption
}

ThreadService contains methods and other services that help with interacting with the agentmail 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 NewThreadService method instead.

func NewThreadService

func NewThreadService(opts ...option.RequestOption) (r ThreadService)

NewThreadService 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 (*ThreadService) Delete added in v0.4.0

func (r *ThreadService) Delete(ctx context.Context, threadID string, body ThreadDeleteParams, opts ...option.RequestOption) (err error)

Moves the thread to trash by adding a trash label to all messages. If the thread is already in trash, it will be permanently deleted. Use `permanent=true` to force permanent deletion.

**CLI:**

```bash agentmail threads delete --thread-id <thread_id> ```

func (*ThreadService) Get

func (r *ThreadService) Get(ctx context.Context, threadID string, opts ...option.RequestOption) (res *Thread, err error)

**CLI:**

```bash agentmail threads get --thread-id <thread_id> ```

func (*ThreadService) GetAttachment

func (r *ThreadService) GetAttachment(ctx context.Context, attachmentID string, query ThreadGetAttachmentParams, opts ...option.RequestOption) (res *AttachmentResponse, err error)

**CLI:**

```bash agentmail threads get-attachment --thread-id <thread_id> --attachment-id <attachment_id> ```

func (*ThreadService) List

func (r *ThreadService) List(ctx context.Context, query ThreadListParams, opts ...option.RequestOption) (res *ListThreads, err error)

**CLI:**

```bash agentmail threads list ```

type UpdateMessageAddLabelsUnionParam added in v0.3.0

type UpdateMessageAddLabelsUnionParam struct {
	OfString      param.Opt[string] `json:",omitzero,inline"`
	OfStringArray []string          `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 (UpdateMessageAddLabelsUnionParam) MarshalJSON added in v0.3.0

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

func (*UpdateMessageAddLabelsUnionParam) UnmarshalJSON added in v0.3.0

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

type UpdateMessageParam

type UpdateMessageParam struct {
	// Label or labels to add to message.
	AddLabels UpdateMessageAddLabelsUnionParam `json:"add_labels,omitzero"`
	// Label or labels to remove from message.
	RemoveLabels UpdateMessageRemoveLabelsUnionParam `json:"remove_labels,omitzero"`
	// contains filtered or unexported fields
}

func (UpdateMessageParam) MarshalJSON

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

func (*UpdateMessageParam) UnmarshalJSON

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

type UpdateMessageRemoveLabelsUnionParam added in v0.3.0

type UpdateMessageRemoveLabelsUnionParam struct {
	OfString      param.Opt[string] `json:",omitzero,inline"`
	OfStringArray []string          `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 (UpdateMessageRemoveLabelsUnionParam) MarshalJSON added in v0.3.0

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

func (*UpdateMessageRemoveLabelsUnionParam) UnmarshalJSON added in v0.3.0

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

type Webhook

type Webhook struct {
	// Time at which webhook was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Webhook is enabled.
	Enabled bool `json:"enabled" api:"required"`
	// Secret for webhook signature verification.
	Secret string `json:"secret" api:"required"`
	// Time at which webhook was last updated.
	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
	// URL of webhook endpoint.
	URL string `json:"url" api:"required"`
	// ID of webhook.
	WebhookID string `json:"webhook_id" api:"required"`
	// Client ID of webhook.
	ClientID string `json:"client_id" api:"nullable"`
	// Event types for which to send events.
	EventTypes []EventType `json:"event_types" api:"nullable"`
	// Inboxes for which to send events. Maximum 10 per webhook.
	InboxIDs []string `json:"inbox_ids" api:"nullable"`
	// Pods for which to send events. Maximum 10 per webhook.
	PodIDs []string `json:"pod_ids" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Enabled     respjson.Field
		Secret      respjson.Field
		UpdatedAt   respjson.Field
		URL         respjson.Field
		WebhookID   respjson.Field
		ClientID    respjson.Field
		EventTypes  respjson.Field
		InboxIDs    respjson.Field
		PodIDs      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Webhook) RawJSON

func (r Webhook) RawJSON() string

Returns the unmodified JSON received from the API

func (*Webhook) UnmarshalJSON

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

type WebhookListParams

type WebhookListParams struct {
	// Sort in ascending temporal order.
	Ascending param.Opt[bool] `query:"ascending,omitzero" json:"-"`
	// Limit of number of items returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page token for pagination.
	PageToken param.Opt[string] `query:"page_token,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (WebhookListParams) URLQuery

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

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

type WebhookListResponse

type WebhookListResponse struct {
	// Number of items returned.
	Count int64 `json:"count" api:"required"`
	// Ordered by `created_at` descending.
	Webhooks []Webhook `json:"webhooks" api:"required"`
	// Limit of number of items returned.
	Limit int64 `json:"limit" api:"nullable"`
	// Page token for pagination.
	NextPageToken string `json:"next_page_token" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count         respjson.Field
		Webhooks      respjson.Field
		Limit         respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WebhookListResponse) RawJSON

func (r WebhookListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WebhookListResponse) UnmarshalJSON

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

type WebhookNewParams

type WebhookNewParams struct {
	// Event types for which to send events.
	EventTypes []EventType `json:"event_types,omitzero" api:"required"`
	// URL of webhook endpoint.
	URL string `json:"url" api:"required"`
	// Client ID of webhook.
	ClientID param.Opt[string] `json:"client_id,omitzero"`
	// Inboxes for which to send events. Maximum 10 per webhook.
	InboxIDs []string `json:"inbox_ids,omitzero"`
	// Pods for which to send events. Maximum 10 per webhook.
	PodIDs []string `json:"pod_ids,omitzero"`
	// contains filtered or unexported fields
}

func (WebhookNewParams) MarshalJSON

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

func (*WebhookNewParams) UnmarshalJSON

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

type WebhookService

type WebhookService struct {
	Options []option.RequestOption
}

WebhookService contains methods and other services that help with interacting with the agentmail 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 NewWebhookService method instead.

func NewWebhookService

func NewWebhookService(opts ...option.RequestOption) (r WebhookService)

NewWebhookService 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 (*WebhookService) Delete

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

**CLI:**

```bash agentmail webhooks delete --webhook-id <webhook_id> ```

func (*WebhookService) Get

func (r *WebhookService) Get(ctx context.Context, webhookID string, opts ...option.RequestOption) (res *Webhook, err error)

**CLI:**

```bash agentmail webhooks get --webhook-id <webhook_id> ```

func (*WebhookService) List

**CLI:**

```bash agentmail webhooks list ```

func (*WebhookService) New

func (r *WebhookService) New(ctx context.Context, body WebhookNewParams, opts ...option.RequestOption) (res *Webhook, err error)

**CLI:**

```bash agentmail webhooks create --url https://example.com/webhook --event-type message.received ```

func (*WebhookService) Update

func (r *WebhookService) Update(ctx context.Context, webhookID string, body WebhookUpdateParams, opts ...option.RequestOption) (res *Webhook, err error)

**CLI:**

```bash agentmail webhooks update --webhook-id <webhook_id> --add-inbox-id <inbox_id> ```

type WebhookUpdateParams

type WebhookUpdateParams struct {
	// Inbox IDs to subscribe to the webhook.
	AddInboxIDs []string `json:"add_inbox_ids,omitzero"`
	// Pod IDs to subscribe to the webhook.
	AddPodIDs []string `json:"add_pod_ids,omitzero"`
	// Inbox IDs to unsubscribe from the webhook.
	RemoveInboxIDs []string `json:"remove_inbox_ids,omitzero"`
	// Pod IDs to unsubscribe from the webhook.
	RemovePodIDs []string `json:"remove_pod_ids,omitzero"`
	// contains filtered or unexported fields
}

func (WebhookUpdateParams) MarshalJSON

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

func (*WebhookUpdateParams) UnmarshalJSON

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

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

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