agentmail

package module
v0.0.0-...-5d5f48c Latest Latest
Warning

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

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

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/[email protected]'

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 `json:"...,required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, 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 {
	// 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"`
	// 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
		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 APIKeyNewParams

type APIKeyNewParams struct {
	// Name of api key.
	Name string `json:"name" api:"required"`
	// 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 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"`
	// 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
		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 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, apiKey string, opts ...option.RequestOption) (err error)

Delete API Key

func (*APIKeyService) List

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

List API Keys

func (*APIKeyService) New

Create API 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 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
	Inboxes       InboxService
	Pods          PodService
	Webhooks      WebhookService
	APIKeys       APIKeyService
	Domains       DomainService
	Drafts        DraftService
	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 <[email protected]>`.
	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., " your-domain.com")
	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
		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 {
	// 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)

Delete Domain

func (*DomainService) Get

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

Get Domain

func (*DomainService) GetZoneFile

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

Get Zone File

func (*DomainService) List

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

List Domains

func (*DomainService) New

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

Create Domain

func (*DomainService) Verify

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

Verify Domain

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 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"`
	// ID of inbox.
	InboxID string `json:"inbox_id" api:"required"`
	// Labels of draft.
	Labels []string `json:"labels" api:"required"`
	// ID of thread.
	ThreadID string `json:"thread_id" 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 `[email protected]` or
	// `Display Name <[email protected]>`.
	Bcc []string `json:"bcc" api:"nullable"`
	// Addresses of CC recipients. In format `[email protected]` or
	// `Display Name <[email protected]>`.
	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 `[email protected]` or
	// `Display Name <[email protected]>`.
	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 `[email protected]` or
	// `Display Name <[email protected]>`.
	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
		ThreadID    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 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)

Get Draft

func (*DraftService) List

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

List Drafts

type Error

type Error = apierror.Error

type EventType

type EventType string
const (
	EventTypeMessageReceived   EventType = "message.received"
	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"`
	// ID of 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 <[email protected]>`.
	DisplayName string `json:"display_name" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   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 InboxDraftDeleteParams

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

type InboxDraftGetParams

type InboxDraftGetParams struct {
	// ID of 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"`
	// Addresses of BCC recipients. In format `[email protected]` or
	// `Display Name <[email protected]>`.
	Bcc []string `json:"bcc,omitzero"`
	// Addresses of CC recipients. In format `[email protected]` or
	// `Display Name <[email protected]>`.
	Cc []string `json:"cc,omitzero"`
	// Labels of draft.
	Labels []string `json:"labels,omitzero"`
	// Reply-to addresses. In format `[email protected]` or
	// `Display Name <[email protected]>`.
	ReplyTo []string `json:"reply_to,omitzero"`
	// Addresses of recipients. In format `[email protected]` or
	// `Display Name <[email protected]>`.
	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 {
	// ID of 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)

Delete Draft

func (*InboxDraftService) Get

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

Get Draft

func (*InboxDraftService) List

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

List Drafts

func (*InboxDraftService) New

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

Create Draft

func (*InboxDraftService) Send

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

Send Draft

func (*InboxDraftService) Update

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

Update Draft

type InboxDraftUpdateParams

type InboxDraftUpdateParams struct {
	// ID of 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 `[email protected]` or
	// `Display Name <[email protected]>`.
	Bcc []string `json:"bcc,omitzero"`
	// Addresses of CC recipients. In format `[email protected]` or
	// `Display Name <[email protected]>`.
	Cc []string `json:"cc,omitzero"`
	// Reply-to addresses. In format `[email protected]` or
	// `Display Name <[email protected]>`.
	ReplyTo []string `json:"reply_to,omitzero"`
	// Addresses of recipients. In format `[email protected]` or
	// `Display Name <[email protected]>`.
	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 InboxListMetricsParams

type InboxListMetricsParams struct {
	// End timestamp for the metrics query range.
	EndTimestamp time.Time `query:"end_timestamp" api:"required" format:"date-time" json:"-"`
	// Start timestamp for the metrics query range.
	StartTimestamp time.Time `query:"start_timestamp" api:"required" format:"date-time" json:"-"`
	// List of metric event types to filter by.
	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 InboxListParams

type InboxListParams 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 (InboxListParams) URLQuery

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

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

type InboxMessageForwardParams

type InboxMessageForwardParams struct {
	// ID of 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 {
	// ID of 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 {
	// ID of inbox.
	InboxID string `path:"inbox_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type InboxMessageGetRawParams

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

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 spam in results.
	IncludeSpam param.Opt[bool] `query:"include_spam,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 `[email protected]` or
	// `Display Name <[email protected]>`.
	From string `json:"from" api:"required"`
	// ID of 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 `[email protected]` or
	// `Display Name <[email protected]>`.
	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 `[email protected]` or
	// `Display Name <[email protected]>`.
	Bcc []string `json:"bcc" api:"nullable"`
	// Addresses of CC recipients. In format `[email protected]` or
	// `Display Name <[email protected]>`.
	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 {
	// ID of 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 {
	// ID of 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)

Forward Message

func (*InboxMessageService) Get

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

Get Message

func (*InboxMessageService) GetAttachment

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

Get Attachment

func (*InboxMessageService) GetRaw

func (r *InboxMessageService) GetRaw(ctx context.Context, messageID string, query InboxMessageGetRawParams, opts ...option.RequestOption) (err error)

Get Raw Message

func (*InboxMessageService) List

List Messages

func (*InboxMessageService) Reply

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

Reply To Message

func (*InboxMessageService) ReplyAll

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

Reply All Message

func (*InboxMessageService) Send

Send Message

func (*InboxMessageService) Update

func (r *InboxMessageService) Update(ctx context.Context, messageID string, params InboxMessageUpdateParams, opts ...option.RequestOption) (res *Message, err error)

Update Message

type InboxMessageUpdateParams

type InboxMessageUpdateParams struct {
	// ID of 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 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
}

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)

Delete Inbox

func (*InboxService) Get

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

Get Inbox

func (*InboxService) List

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

List Inboxes

func (*InboxService) ListMetrics

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

List Metrics

func (*InboxService) New

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

Create Inbox

func (*InboxService) Update

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

Update Inbox

type InboxThreadDeleteParams

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

type InboxThreadGetAttachmentParams

type InboxThreadGetAttachmentParams struct {
	// ID of 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 {
	// ID of 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 spam in results.
	IncludeSpam param.Opt[bool] `query:"include_spam,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, body InboxThreadDeleteParams, opts ...option.RequestOption) (err error)

Delete Thread

func (*InboxThreadService) Get

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

Get Thread

func (*InboxThreadService) GetAttachment

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

Get Attachment

func (*InboxThreadService) List

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

List Threads

type InboxUpdateParams

type InboxUpdateParams struct {
	// Display name: `Display Name <[email protected]>`.
	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 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., " your-domain.com")
	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
		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"`
	// ID of inbox.
	InboxID string `json:"inbox_id" api:"required"`
	// Labels of draft.
	Labels []string `json:"labels" api:"required"`
	// ID of thread.
	ThreadID string `json:"thread_id" 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 `[email protected]` or
	// `Display Name <[email protected]>`.
	Bcc []string `json:"bcc" api:"nullable"`
	// Addresses of CC recipients. In format `[email protected]` or
	// `Display Name <[email protected]>`.
	Cc []string `json:"cc" 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 `[email protected]` or
	// `Display Name <[email protected]>`.
	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
		ThreadID    respjson.Field
		UpdatedAt   respjson.Field
		Attachments respjson.Field
		Bcc         respjson.Field
		Cc          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 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 ListMetrics

type ListMetrics struct {
	// Message metrics grouped by event type.
	Message ListMetricsMessage `json:"message" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListMetrics) RawJSON

func (r ListMetrics) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListMetrics) UnmarshalJSON

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

type ListMetricsMessage

type ListMetricsMessage struct {
	// Timestamps when messages bounced.
	Bounced []time.Time `json:"bounced" api:"nullable" format:"date-time"`
	// Timestamps when messages received complaints.
	Complained []time.Time `json:"complained" api:"nullable" format:"date-time"`
	// Timestamps when messages were delayed.
	Delayed []time.Time `json:"delayed" api:"nullable" format:"date-time"`
	// Timestamps when messages were delivered.
	Delivered []time.Time `json:"delivered" api:"nullable" format:"date-time"`
	// Timestamps when messages were received.
	Received []time.Time `json:"received" api:"nullable" format:"date-time"`
	// Timestamps when messages were rejected.
	Rejected []time.Time `json:"rejected" api:"nullable" format:"date-time"`
	// Timestamps when messages were sent.
	Sent []time.Time `json:"sent" api:"nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Bounced     respjson.Field
		Complained  respjson.Field
		Delayed     respjson.Field
		Delivered   respjson.Field
		Received    respjson.Field
		Rejected    respjson.Field
		Sent        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Message metrics grouped by event type.

func (ListMetricsMessage) RawJSON

func (r ListMetricsMessage) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListMetricsMessage) UnmarshalJSON

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

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"`
	// ID of 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 `[email protected]` or
	// `Display Name <[email protected]>`.
	Recipients []string `json:"recipients" api:"required"`
	// Senders in thread. In format `[email protected]` or
	// `Display Name <[email protected]>`.
	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 `[email protected]` or
	// `Display Name <[email protected]>`.
	From string `json:"from" api:"required"`
	// ID of 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 `[email protected]` or
	// `Display Name <[email protected]>`.
	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 `[email protected]` or
	// `Display Name <[email protected]>`.
	Bcc []string `json:"bcc" api:"nullable"`
	// Addresses of CC recipients. In format `[email protected]` or
	// `Display Name <[email protected]>`.
	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 `[email protected]` or
	// `Display Name <[email protected]>`.
	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 {
	// End timestamp for the metrics query range.
	EndTimestamp time.Time `query:"end_timestamp" api:"required" format:"date-time" json:"-"`
	// Start timestamp for the metrics query range.
	StartTimestamp time.Time `query:"start_timestamp" api:"required" format:"date-time" json:"-"`
	// List of metric event types to filter by.
	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 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 *ListMetrics, err error)

List Metrics

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"`
	// 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
		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

Get the current organization.

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 PodDomainDeleteParams

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

type PodDomainListParams

type PodDomainListParams 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 (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)

Delete Domain

func (*PodDomainService) List

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

List Domains

func (*PodDomainService) New

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

Create Domain

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)

Get Draft

func (*PodDraftService) List

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

List Drafts

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 {
	// 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)

Delete Inbox

func (*PodInboxService) Get

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

Get Inbox

func (*PodInboxService) List

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

List Inboxes

func (*PodInboxService) New

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

Create Inbox

type PodListParams

type PodListParams 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 (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 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
}

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)

Delete Pod

func (*PodService) Get

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

Get Pod

func (*PodService) List

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

List Pods

func (*PodService) New

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

Create Pod

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 spam in results.
	IncludeSpam param.Opt[bool] `query:"include_spam,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) Get

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

Get Thread

func (*PodThreadService) GetAttachment

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

Get Attachment

func (*PodThreadService) List

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

List Threads

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"`
	// ID of 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 `[email protected]` or
	// `Display Name <[email protected]>`.
	Recipients []string `json:"recipients" api:"required"`
	// Senders in thread. In format `[email protected]` or
	// `Display Name <[email protected]>`.
	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 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 spam in results.
	IncludeSpam param.Opt[bool] `query:"include_spam,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) Get

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

Get Thread

func (*ThreadService) GetAttachment

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

Get Attachment

func (*ThreadService) List

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

List Threads

type UpdateMessageParam

type UpdateMessageParam struct {
	// Labels to add to message.
	AddLabels []string `json:"add_labels,omitzero"`
	// Labels to remove from message.
	RemoveLabels []string `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 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 {
	// 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)

Delete Webhook

func (*WebhookService) Get

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

Get Webhook

func (*WebhookService) List

List Webhooks

func (*WebhookService) New

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

Create Webhook

func (*WebhookService) Update

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

Update Webhook

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