ark

package module
v0.18.1 Latest Latest
Warning

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

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

README

Ark Go API Library

Go Reference

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

It is generated with Stainless.

MCP Server

Use the Ark MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.

Add to Cursor Install in VS Code

Note: You may need to set environment variables in your MCP client.

Installation

import (
	"github.com/ArkHQ-io/ark-go" // imported as ark
)

Or to pin the version:

go get -u 'github.com/ArkHQ-io/[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/ArkHQ-io/ark-go"
	"github.com/ArkHQ-io/ark-go/option"
)

func main() {
	client := ark.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("ARK_API_KEY")
	)
	response, err := client.Emails.Send(context.TODO(), ark.EmailSendParams{
		From:    "[email protected]",
		Subject: "Hello World",
		To:      []string{"[email protected]"},
		HTML:    ark.String("<h1>Welcome!</h1>"),
		Metadata: map[string]string{
			"user_id":  "usr_123456",
			"campaign": "onboarding",
		},
		Tag: ark.String("welcome"),
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Data)
}

Request fields

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

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

	Origin: ark.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[ark.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 := ark.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

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

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

See the full list of request options.

Pagination

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

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

iter := client.Emails.ListAutoPaging(context.TODO(), ark.EmailListParams{
	Page:    ark.Int(1),
	PerPage: ark.Int(10),
})
// Automatically fetches more pages as needed.
for iter.Next() {
	emailListResponse := iter.Current()
	fmt.Printf("%+v\n", emailListResponse)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

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

page, err := client.Emails.List(context.TODO(), ark.EmailListParams{
	Page:    ark.Int(1),
	PerPage: ark.Int(10),
})
for page != nil {
	for _, email := range page.Data {
		fmt.Printf("%+v\n", email)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *ark.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.Emails.Send(context.TODO(), ark.EmailSendParams{
	From:    "[email protected]",
	Subject: "Hello World",
	To:      []string{"[email protected]"},
	HTML:    ark.String("<h1>Welcome!</h1>"),
	Metadata: map[string]string{
		"user_id":  "usr_123456",
		"campaign": "onboarding",
	},
	Tag: ark.String("welcome"),
})
if err != nil {
	var apierr *ark.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 "/emails": 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.Emails.Send(
	ctx,
	ark.EmailSendParams{
		From:    "[email protected]",
		Subject: "Hello World",
		To:      []string{"[email protected]"},
		HTML:    ark.String("<h1>Welcome!</h1>"),
		Metadata: map[string]string{
			"user_id":  "usr_123456",
			"campaign": "onboarding",
		},
		Tag: ark.String("welcome"),
	},
	// 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 ark.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 := ark.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Emails.Send(
	context.TODO(),
	ark.EmailSendParams{
		From:    "[email protected]",
		Subject: "Hello World",
		To:      []string{"[email protected]"},
		HTML:    ark.String("<h1>Welcome!</h1>"),
		Metadata: map[string]string{
			"user_id":  "usr_123456",
			"campaign": "onboarding",
		},
		Tag: ark.String("welcome"),
	},
	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
response, err := client.Emails.Send(
	context.TODO(),
	ark.EmailSendParams{
		From:    "[email protected]",
		Subject: "Hello World",
		To:      []string{"[email protected]"},
		HTML:    ark.String("<h1>Welcome!</h1>"),
		Metadata: map[string]string{
			"user_id":  "usr_123456",
			"campaign": "onboarding",
		},
		Tag: ark.String("welcome"),
	},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", response)

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: ark.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 := ark.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 (ARK_API_KEY, ARK_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 APIMeta

type APIMeta = shared.APIMeta

This is an alias to an internal type.

type Client

type Client struct {
	Options  []option.RequestOption
	Emails   EmailService
	Logs     LogService
	Usage    UsageService
	Limits   LimitService
	Tenants  TenantService
	Platform PlatformService
}

Client creates a struct with services and top level methods that help with interacting with the ark 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 (ARK_API_KEY, ARK_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 DNSRecord

type DNSRecord struct {
	// The complete fully-qualified domain name (FQDN). Use this as a reference to
	// verify the record is configured correctly.
	FullName string `json:"fullName,required"`
	// The relative hostname to enter in your DNS provider. Most DNS providers
	// auto-append the zone name, so you only need to enter this relative part.
	//
	// - `"@"` means the apex/root of the zone (for root domains)
	// - `"mail"` for a subdomain like `mail.example.com`
	// - `"ark-xyz._domainkey.mail"` for DKIM on a subdomain
	Name string `json:"name,required"`
	// The DNS record type to create
	//
	// Any of "TXT", "CNAME", "MX".
	Type DNSRecordType `json:"type,required"`
	// The value to set for the DNS record
	Value string `json:"value,required"`
	// Current verification status of this DNS record:
	//
	// - `OK` - Record is correctly configured and verified
	// - `Missing` - Record was not found in your DNS
	// - `Invalid` - Record exists but has an incorrect value
	// - `null` - Record has not been checked yet
	//
	// Any of "OK", "Missing", "Invalid".
	Status DNSRecordStatus `json:"status,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FullName    respjson.Field
		Name        respjson.Field
		Type        respjson.Field
		Value       respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A DNS record that needs to be configured in your domain's DNS settings.

The `name` field contains the relative hostname to enter in your DNS provider (which auto-appends the zone). The `fullName` field contains the complete fully-qualified domain name (FQDN) for reference.

**Example for subdomain `mail.example.com`:**

- `name`: `"mail"` (what you enter in DNS provider) - `fullName`: `"mail.example.com"` (the complete hostname)

**Example for root domain `example.com`:**

- `name`: `"@"` (DNS shorthand for apex/root) - `fullName`: `"example.com"`

func (DNSRecord) RawJSON

func (r DNSRecord) RawJSON() string

Returns the unmodified JSON received from the API

func (*DNSRecord) UnmarshalJSON

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

type DNSRecordStatus

type DNSRecordStatus string

Current verification status of this DNS record:

- `OK` - Record is correctly configured and verified - `Missing` - Record was not found in your DNS - `Invalid` - Record exists but has an incorrect value - `null` - Record has not been checked yet

const (
	DNSRecordStatusOk      DNSRecordStatus = "OK"
	DNSRecordStatusMissing DNSRecordStatus = "Missing"
	DNSRecordStatusInvalid DNSRecordStatus = "Invalid"
)

type DNSRecordType

type DNSRecordType string

The DNS record type to create

const (
	DNSRecordTypeTxt   DNSRecordType = "TXT"
	DNSRecordTypeCname DNSRecordType = "CNAME"
	DNSRecordTypeMx    DNSRecordType = "MX"
)

type EmailCounts added in v0.18.0

type EmailCounts struct {
	// Emails that bounced
	Bounced int64 `json:"bounced,required"`
	// Emails successfully delivered
	Delivered int64 `json:"delivered,required"`
	// Emails that hard-failed (permanent failures)
	HardFailed int64 `json:"hard_failed,required"`
	// Emails currently held for review
	Held int64 `json:"held,required"`
	// Total emails sent
	Sent int64 `json:"sent,required"`
	// Emails that soft-failed (temporary failures, may be retried)
	SoftFailed int64 `json:"soft_failed,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Bounced     respjson.Field
		Delivered   respjson.Field
		HardFailed  respjson.Field
		Held        respjson.Field
		Sent        respjson.Field
		SoftFailed  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Email delivery counts

func (EmailCounts) RawJSON added in v0.18.0

func (r EmailCounts) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailCounts) UnmarshalJSON added in v0.18.0

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

type EmailGetDeliveriesResponse

type EmailGetDeliveriesResponse struct {
	Data    EmailGetDeliveriesResponseData `json:"data,required"`
	Meta    shared.APIMeta                 `json:"meta,required"`
	Success bool                           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailGetDeliveriesResponse) RawJSON

func (r EmailGetDeliveriesResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailGetDeliveriesResponse) UnmarshalJSON

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

type EmailGetDeliveriesResponseData

type EmailGetDeliveriesResponseData struct {
	// Message identifier (token)
	ID string `json:"id,required"`
	// Whether the message can be manually retried via `POST /emails/{emailId}/retry`.
	// `true` when the raw message content is still available (not expired). Messages
	// older than the retention period cannot be retried.
	CanRetryManually bool `json:"canRetryManually,required"`
	// Chronological list of delivery attempts for this message. Each attempt includes
	// SMTP response codes and timestamps.
	Deliveries []EmailGetDeliveriesResponseDataDelivery `json:"deliveries,required"`
	// Information about the current retry state of a message that is queued for
	// delivery. Only present when the message is in the delivery queue.
	RetryState EmailGetDeliveriesResponseDataRetryState `json:"retryState,required"`
	// Current message status (lowercase). Possible values:
	//
	// - `pending` - Initial state, awaiting first delivery attempt
	// - `sent` - Successfully delivered
	// - `softfail` - Temporary failure, will retry automatically
	// - `hardfail` - Permanent failure, will not retry
	// - `held` - Held for manual review (suppression list, etc.)
	// - `bounced` - Bounced by recipient server
	//
	// Any of "pending", "sent", "softfail", "hardfail", "held", "bounced".
	Status string `json:"status,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID               respjson.Field
		CanRetryManually respjson.Field
		Deliveries       respjson.Field
		RetryState       respjson.Field
		Status           respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailGetDeliveriesResponseData) RawJSON

Returns the unmodified JSON received from the API

func (*EmailGetDeliveriesResponseData) UnmarshalJSON

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

type EmailGetDeliveriesResponseDataDelivery added in v0.3.0

type EmailGetDeliveriesResponseDataDelivery struct {
	// Delivery attempt ID
	ID string `json:"id,required"`
	// Delivery status (lowercase)
	Status string `json:"status,required"`
	// Unix timestamp
	Timestamp float64 `json:"timestamp,required"`
	// ISO 8601 timestamp
	TimestampISO time.Time `json:"timestampIso,required" format:"date-time"`
	// Bounce classification category (present for failed deliveries). Helps understand
	// why delivery failed for analytics and automated handling.
	//
	// Any of "invalid_recipient", "mailbox_full", "message_too_large", "spam_block",
	// "policy_violation", "no_mailbox", "not_accepting_mail",
	// "temporarily_unavailable", "protocol_error", "tls_required", "connection_error",
	// "dns_error", "unclassified".
	Classification string `json:"classification,nullable"`
	// Numeric bounce classification code for programmatic handling. Codes:
	// 10=invalid_recipient, 11=no_mailbox, 12=not_accepting_mail, 20=mailbox_full,
	// 21=message_too_large, 30=spam_block, 31=policy_violation, 32=tls_required,
	// 40=connection_error, 41=dns_error, 42=temporarily_unavailable,
	// 50=protocol_error, 99=unclassified
	ClassificationCode int64 `json:"classificationCode,nullable"`
	// SMTP response code
	Code int64 `json:"code"`
	// Human-readable delivery summary. Format varies by status:
	//
	//   - **sent**: `Message for {recipient} accepted by {ip}:{port} ({hostname})`
	//   - **softfail/hardfail**:
	//     `{code} {classification}: Delivery to {recipient} failed at {ip}:{port} ({hostname})`
	Details string `json:"details"`
	// Raw SMTP response from the receiving mail server
	Output string `json:"output"`
	// Hostname of the remote mail server that processed the delivery. Present for all
	// delivery attempts (successful and failed).
	RemoteHost string `json:"remoteHost,nullable"`
	// Whether TLS was used
	SentWithSsl bool `json:"sentWithSsl"`
	// RFC 3463 enhanced status code from SMTP response (e.g., "5.1.1", "4.2.2"). First
	// digit: 2=success, 4=temporary, 5=permanent. Second digit: category (1=address,
	// 2=mailbox, 7=security, etc.).
	SmtpEnhancedCode string `json:"smtpEnhancedCode,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                 respjson.Field
		Status             respjson.Field
		Timestamp          respjson.Field
		TimestampISO       respjson.Field
		Classification     respjson.Field
		ClassificationCode respjson.Field
		Code               respjson.Field
		Details            respjson.Field
		Output             respjson.Field
		RemoteHost         respjson.Field
		SentWithSsl        respjson.Field
		SmtpEnhancedCode   respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailGetDeliveriesResponseDataDelivery) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*EmailGetDeliveriesResponseDataDelivery) UnmarshalJSON added in v0.3.0

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

type EmailGetDeliveriesResponseDataRetryState added in v0.9.0

type EmailGetDeliveriesResponseDataRetryState struct {
	// Current attempt number (0-indexed). The first delivery attempt is 0, the first
	// retry is 1, and so on.
	Attempt int64 `json:"attempt,required"`
	// Number of attempts remaining before the message is hard-failed. Calculated as
	// `maxAttempts - attempt`.
	AttemptsRemaining int64 `json:"attemptsRemaining,required"`
	// Whether this queue entry was created by a manual retry request. Manual retries
	// bypass certain hold conditions like suppression lists.
	Manual bool `json:"manual,required"`
	// Maximum number of delivery attempts before the message is hard-failed.
	// Configured at the server level.
	MaxAttempts int64 `json:"maxAttempts,required"`
	// Whether the message is currently being processed by a delivery worker. When
	// `true`, the message is actively being sent.
	Processing bool `json:"processing,required"`
	// Unix timestamp of when the next retry attempt is scheduled. `null` if the
	// message is ready for immediate processing or currently being processed.
	NextRetryAt float64 `json:"nextRetryAt,nullable"`
	// ISO 8601 formatted timestamp of the next retry attempt. `null` if the message is
	// ready for immediate processing.
	NextRetryAtISO time.Time `json:"nextRetryAtIso,nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Attempt           respjson.Field
		AttemptsRemaining respjson.Field
		Manual            respjson.Field
		MaxAttempts       respjson.Field
		Processing        respjson.Field
		NextRetryAt       respjson.Field
		NextRetryAtISO    respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about the current retry state of a message that is queued for delivery. Only present when the message is in the delivery queue.

func (EmailGetDeliveriesResponseDataRetryState) RawJSON added in v0.9.0

Returns the unmodified JSON received from the API

func (*EmailGetDeliveriesResponseDataRetryState) UnmarshalJSON added in v0.9.0

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

type EmailGetParams

type EmailGetParams struct {
	// Comma-separated list of fields to include:
	//
	// - `full` - Include all expanded fields in a single request
	// - `content` - HTML and plain text body
	// - `headers` - Email headers
	// - `deliveries` - Delivery attempt history
	// - `activity` - Opens and clicks tracking data
	// - `attachments` - File attachments with content (base64 encoded)
	// - `raw` - Complete raw MIME message (base64 encoded)
	Expand param.Opt[string] `query:"expand,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (EmailGetParams) URLQuery

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

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

type EmailGetResponse

type EmailGetResponse struct {
	Data    EmailGetResponseData `json:"data,required"`
	Meta    shared.APIMeta       `json:"meta,required"`
	Success bool                 `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailGetResponse) RawJSON

func (r EmailGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailGetResponse) UnmarshalJSON

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

type EmailGetResponseData

type EmailGetResponseData struct {
	// Unique message identifier (token)
	ID string `json:"id,required"`
	// Sender address
	From string `json:"from,required"`
	// Message direction
	//
	// Any of "outgoing", "incoming".
	Scope string `json:"scope,required"`
	// Current delivery status:
	//
	// - `pending` - Email accepted, waiting to be processed
	// - `sent` - Email transmitted to recipient's mail server
	// - `softfail` - Temporary delivery failure, will retry
	// - `hardfail` - Permanent delivery failure
	// - `bounced` - Email bounced back
	// - `held` - Held for manual review
	//
	// Any of "pending", "sent", "softfail", "hardfail", "bounced", "held".
	Status string `json:"status,required"`
	// Email subject line
	Subject string `json:"subject,required"`
	// Unix timestamp when the email was sent
	Timestamp float64 `json:"timestamp,required"`
	// ISO 8601 formatted timestamp
	TimestampISO time.Time `json:"timestampIso,required" format:"date-time"`
	// Recipient address
	To string `json:"to,required" format:"email"`
	// Opens and clicks tracking data (included if expand=activity)
	Activity EmailGetResponseDataActivity `json:"activity"`
	// File attachments (included if expand=attachments)
	Attachments []EmailGetResponseDataAttachment `json:"attachments"`
	// Delivery attempt history (included if expand=deliveries)
	Deliveries []EmailGetResponseDataDelivery `json:"deliveries"`
	// Email headers (included if expand=headers)
	Headers map[string]string `json:"headers"`
	// HTML body content (included if expand=content)
	HTMLBody string `json:"htmlBody"`
	// SMTP Message-ID header
	MessageID string `json:"messageId"`
	// Plain text body (included if expand=content)
	PlainBody string `json:"plainBody"`
	// Complete raw MIME message, base64 encoded (included if expand=raw). Decode this
	// to get the original RFC 2822 formatted email.
	RawMessage string `json:"rawMessage"`
	// Whether the message was flagged as spam
	Spam bool `json:"spam"`
	// Spam score (if applicable)
	SpamScore float64 `json:"spamScore"`
	// Optional categorization tag
	Tag string `json:"tag"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		From         respjson.Field
		Scope        respjson.Field
		Status       respjson.Field
		Subject      respjson.Field
		Timestamp    respjson.Field
		TimestampISO respjson.Field
		To           respjson.Field
		Activity     respjson.Field
		Attachments  respjson.Field
		Deliveries   respjson.Field
		Headers      respjson.Field
		HTMLBody     respjson.Field
		MessageID    respjson.Field
		PlainBody    respjson.Field
		RawMessage   respjson.Field
		Spam         respjson.Field
		SpamScore    respjson.Field
		Tag          respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailGetResponseData) RawJSON

func (r EmailGetResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailGetResponseData) UnmarshalJSON

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

type EmailGetResponseDataActivity added in v0.13.0

type EmailGetResponseDataActivity struct {
	// List of link click events
	Clicks []EmailGetResponseDataActivityClick `json:"clicks"`
	// List of email open events
	Opens []EmailGetResponseDataActivityOpen `json:"opens"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Clicks      respjson.Field
		Opens       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Opens and clicks tracking data (included if expand=activity)

func (EmailGetResponseDataActivity) RawJSON added in v0.13.0

Returns the unmodified JSON received from the API

func (*EmailGetResponseDataActivity) UnmarshalJSON added in v0.13.0

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

type EmailGetResponseDataActivityClick added in v0.13.0

type EmailGetResponseDataActivityClick struct {
	// IP address of the clicker
	IPAddress string `json:"ipAddress"`
	// Unix timestamp of the click event
	Timestamp float64 `json:"timestamp"`
	// ISO 8601 timestamp of the click event
	TimestampISO time.Time `json:"timestampIso" format:"date-time"`
	// URL that was clicked
	URL string `json:"url" format:"uri"`
	// User agent of the email client
	UserAgent string `json:"userAgent"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		IPAddress    respjson.Field
		Timestamp    respjson.Field
		TimestampISO respjson.Field
		URL          respjson.Field
		UserAgent    respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailGetResponseDataActivityClick) RawJSON added in v0.13.0

Returns the unmodified JSON received from the API

func (*EmailGetResponseDataActivityClick) UnmarshalJSON added in v0.13.0

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

type EmailGetResponseDataActivityOpen added in v0.13.0

type EmailGetResponseDataActivityOpen struct {
	// IP address of the opener
	IPAddress string `json:"ipAddress"`
	// Unix timestamp of the open event
	Timestamp float64 `json:"timestamp"`
	// ISO 8601 timestamp of the open event
	TimestampISO time.Time `json:"timestampIso" format:"date-time"`
	// User agent of the email client
	UserAgent string `json:"userAgent"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		IPAddress    respjson.Field
		Timestamp    respjson.Field
		TimestampISO respjson.Field
		UserAgent    respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailGetResponseDataActivityOpen) RawJSON added in v0.13.0

Returns the unmodified JSON received from the API

func (*EmailGetResponseDataActivityOpen) UnmarshalJSON added in v0.13.0

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

type EmailGetResponseDataAttachment added in v0.13.0

type EmailGetResponseDataAttachment struct {
	// MIME type of the attachment
	ContentType string `json:"contentType,required"`
	// Base64 encoded attachment content. Decode this to get the raw file bytes.
	Data string `json:"data,required"`
	// Original filename of the attachment
	Filename string `json:"filename,required"`
	// SHA256 hash of the attachment content for verification
	Hash string `json:"hash,required"`
	// Size of the attachment in bytes
	Size int64 `json:"size,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ContentType respjson.Field
		Data        respjson.Field
		Filename    respjson.Field
		Hash        respjson.Field
		Size        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An email attachment retrieved from a sent message

func (EmailGetResponseDataAttachment) RawJSON added in v0.13.0

Returns the unmodified JSON received from the API

func (*EmailGetResponseDataAttachment) UnmarshalJSON added in v0.13.0

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

type EmailGetResponseDataDelivery added in v0.3.0

type EmailGetResponseDataDelivery struct {
	// Delivery attempt ID
	ID string `json:"id,required"`
	// Delivery status (lowercase)
	Status string `json:"status,required"`
	// Unix timestamp
	Timestamp float64 `json:"timestamp,required"`
	// ISO 8601 timestamp
	TimestampISO time.Time `json:"timestampIso,required" format:"date-time"`
	// Bounce classification category (present for failed deliveries). Helps understand
	// why delivery failed for analytics and automated handling.
	//
	// Any of "invalid_recipient", "mailbox_full", "message_too_large", "spam_block",
	// "policy_violation", "no_mailbox", "not_accepting_mail",
	// "temporarily_unavailable", "protocol_error", "tls_required", "connection_error",
	// "dns_error", "unclassified".
	Classification string `json:"classification,nullable"`
	// Numeric bounce classification code for programmatic handling. Codes:
	// 10=invalid_recipient, 11=no_mailbox, 12=not_accepting_mail, 20=mailbox_full,
	// 21=message_too_large, 30=spam_block, 31=policy_violation, 32=tls_required,
	// 40=connection_error, 41=dns_error, 42=temporarily_unavailable,
	// 50=protocol_error, 99=unclassified
	ClassificationCode int64 `json:"classificationCode,nullable"`
	// SMTP response code
	Code int64 `json:"code"`
	// Human-readable delivery summary. Format varies by status:
	//
	//   - **sent**: `Message for {recipient} accepted by {ip}:{port} ({hostname})`
	//   - **softfail/hardfail**:
	//     `{code} {classification}: Delivery to {recipient} failed at {ip}:{port} ({hostname})`
	Details string `json:"details"`
	// Raw SMTP response from the receiving mail server
	Output string `json:"output"`
	// Hostname of the remote mail server that processed the delivery. Present for all
	// delivery attempts (successful and failed).
	RemoteHost string `json:"remoteHost,nullable"`
	// Whether TLS was used
	SentWithSsl bool `json:"sentWithSsl"`
	// RFC 3463 enhanced status code from SMTP response (e.g., "5.1.1", "4.2.2"). First
	// digit: 2=success, 4=temporary, 5=permanent. Second digit: category (1=address,
	// 2=mailbox, 7=security, etc.).
	SmtpEnhancedCode string `json:"smtpEnhancedCode,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                 respjson.Field
		Status             respjson.Field
		Timestamp          respjson.Field
		TimestampISO       respjson.Field
		Classification     respjson.Field
		ClassificationCode respjson.Field
		Code               respjson.Field
		Details            respjson.Field
		Output             respjson.Field
		RemoteHost         respjson.Field
		SentWithSsl        respjson.Field
		SmtpEnhancedCode   respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailGetResponseDataDelivery) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*EmailGetResponseDataDelivery) UnmarshalJSON added in v0.3.0

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

type EmailListParams

type EmailListParams struct {
	// Return emails sent after this timestamp (Unix seconds or ISO 8601)
	After param.Opt[string] `query:"after,omitzero" json:"-"`
	// Return emails sent before this timestamp
	Before param.Opt[string] `query:"before,omitzero" json:"-"`
	// Filter by sender email address
	From param.Opt[string] `query:"from,omitzero" format:"email" json:"-"`
	// Page number (starts at 1)
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Results per page (max 100)
	PerPage param.Opt[int64] `query:"perPage,omitzero" json:"-"`
	// Filter by tag
	Tag param.Opt[string] `query:"tag,omitzero" json:"-"`
	// Filter by recipient email address
	To param.Opt[string] `query:"to,omitzero" format:"email" json:"-"`
	// Filter by delivery status:
	//
	// - `pending` - Email accepted, waiting to be processed
	// - `sent` - Email transmitted to recipient's mail server
	// - `softfail` - Temporary delivery failure, will retry
	// - `hardfail` - Permanent delivery failure
	// - `bounced` - Email bounced back
	// - `held` - Held for manual review
	//
	// Any of "pending", "sent", "softfail", "hardfail", "bounced", "held".
	Status EmailListParamsStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (EmailListParams) URLQuery

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

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

type EmailListParamsStatus

type EmailListParamsStatus string

Filter by delivery status:

- `pending` - Email accepted, waiting to be processed - `sent` - Email transmitted to recipient's mail server - `softfail` - Temporary delivery failure, will retry - `hardfail` - Permanent delivery failure - `bounced` - Email bounced back - `held` - Held for manual review

const (
	EmailListParamsStatusPending  EmailListParamsStatus = "pending"
	EmailListParamsStatusSent     EmailListParamsStatus = "sent"
	EmailListParamsStatusSoftfail EmailListParamsStatus = "softfail"
	EmailListParamsStatusHardfail EmailListParamsStatus = "hardfail"
	EmailListParamsStatusBounced  EmailListParamsStatus = "bounced"
	EmailListParamsStatusHeld     EmailListParamsStatus = "held"
)

type EmailListResponse

type EmailListResponse struct {
	// Unique message identifier (token)
	ID   string `json:"id,required"`
	From string `json:"from,required"`
	// Current delivery status:
	//
	// - `pending` - Email accepted, waiting to be processed
	// - `sent` - Email transmitted to recipient's mail server
	// - `softfail` - Temporary delivery failure, will retry
	// - `hardfail` - Permanent delivery failure
	// - `bounced` - Email bounced back
	// - `held` - Held for manual review
	//
	// Any of "pending", "sent", "softfail", "hardfail", "bounced", "held".
	Status       EmailListResponseStatus `json:"status,required"`
	Subject      string                  `json:"subject,required"`
	Timestamp    float64                 `json:"timestamp,required"`
	TimestampISO time.Time               `json:"timestampIso,required" format:"date-time"`
	To           string                  `json:"to,required" format:"email"`
	Tag          string                  `json:"tag"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		From         respjson.Field
		Status       respjson.Field
		Subject      respjson.Field
		Timestamp    respjson.Field
		TimestampISO respjson.Field
		To           respjson.Field
		Tag          respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailListResponse) RawJSON

func (r EmailListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailListResponse) UnmarshalJSON

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

type EmailListResponseStatus added in v0.4.0

type EmailListResponseStatus string

Current delivery status:

- `pending` - Email accepted, waiting to be processed - `sent` - Email transmitted to recipient's mail server - `softfail` - Temporary delivery failure, will retry - `hardfail` - Permanent delivery failure - `bounced` - Email bounced back - `held` - Held for manual review

const (
	EmailListResponseStatusPending  EmailListResponseStatus = "pending"
	EmailListResponseStatusSent     EmailListResponseStatus = "sent"
	EmailListResponseStatusSoftfail EmailListResponseStatus = "softfail"
	EmailListResponseStatusHardfail EmailListResponseStatus = "hardfail"
	EmailListResponseStatusBounced  EmailListResponseStatus = "bounced"
	EmailListResponseStatusHeld     EmailListResponseStatus = "held"
)

type EmailRates added in v0.18.0

type EmailRates struct {
	// Percentage of sent emails that bounced (0-1)
	BounceRate float64 `json:"bounce_rate,required"`
	// Percentage of sent emails that were delivered (0-1)
	DeliveryRate float64 `json:"delivery_rate,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BounceRate   respjson.Field
		DeliveryRate respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Email delivery rates (as decimals, e.g., 0.95 = 95%)

func (EmailRates) RawJSON added in v0.18.0

func (r EmailRates) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailRates) UnmarshalJSON added in v0.18.0

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

type EmailRetryResponse

type EmailRetryResponse struct {
	Data    EmailRetryResponseData `json:"data,required"`
	Meta    shared.APIMeta         `json:"meta,required"`
	Success bool                   `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailRetryResponse) RawJSON

func (r EmailRetryResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailRetryResponse) UnmarshalJSON

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

type EmailRetryResponseData

type EmailRetryResponseData struct {
	// Email identifier (token)
	ID      string `json:"id,required"`
	Message string `json:"message,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Message     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailRetryResponseData) RawJSON

func (r EmailRetryResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailRetryResponseData) UnmarshalJSON

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

type EmailSendBatchParams

type EmailSendBatchParams struct {
	Emails []EmailSendBatchParamsEmail `json:"emails,omitzero,required"`
	// Sender email for all messages
	From           string            `json:"from,required"`
	IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (EmailSendBatchParams) MarshalJSON

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

func (*EmailSendBatchParams) UnmarshalJSON

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

type EmailSendBatchParamsEmail

type EmailSendBatchParamsEmail struct {
	Subject string            `json:"subject,required"`
	To      []string          `json:"to,omitzero,required" format:"email"`
	HTML    param.Opt[string] `json:"html,omitzero"`
	// Tag for categorization and filtering
	Tag  param.Opt[string] `json:"tag,omitzero"`
	Text param.Opt[string] `json:"text,omitzero"`
	// Custom key-value pairs attached to an email for webhook correlation.
	//
	// When you send an email with metadata, these key-value pairs are:
	//
	// - **Stored** with the message
	// - **Returned** in all webhook event payloads (MessageSent, MessageBounced, etc.)
	// - **Never visible** to email recipients
	//
	// This is useful for correlating webhook events with your internal systems (e.g.,
	// user IDs, order IDs, campaign identifiers).
	//
	// **Validation Rules:**
	//
	//   - Maximum 10 keys per email
	//   - Keys: 1-40 characters, must start with a letter, only alphanumeric and
	//     underscores (`^[a-zA-Z][a-zA-Z0-9_]*$`)
	//   - Values: 1-500 characters, no control characters (newlines, tabs, etc.)
	//   - Total size: 4KB maximum (JSON-encoded)
	Metadata map[string]string `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

The properties Subject, To are required.

func (EmailSendBatchParamsEmail) MarshalJSON

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

func (*EmailSendBatchParamsEmail) UnmarshalJSON

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

type EmailSendBatchResponse

type EmailSendBatchResponse struct {
	Data    EmailSendBatchResponseData `json:"data,required"`
	Meta    shared.APIMeta             `json:"meta,required"`
	Success bool                       `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailSendBatchResponse) RawJSON

func (r EmailSendBatchResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailSendBatchResponse) UnmarshalJSON

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

type EmailSendBatchResponseData

type EmailSendBatchResponseData struct {
	// Successfully accepted emails
	Accepted int64 `json:"accepted,required"`
	// Failed emails
	Failed int64 `json:"failed,required"`
	// Map of recipient email to message info
	Messages map[string]EmailSendBatchResponseDataMessage `json:"messages,required"`
	// Total emails in the batch
	Total int64 `json:"total,required"`
	// Whether this batch was sent in sandbox mode. Only present (and true) for sandbox
	// emails sent from @arkhq.io addresses.
	Sandbox bool `json:"sandbox"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accepted    respjson.Field
		Failed      respjson.Field
		Messages    respjson.Field
		Total       respjson.Field
		Sandbox     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailSendBatchResponseData) RawJSON

func (r EmailSendBatchResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailSendBatchResponseData) UnmarshalJSON

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

type EmailSendBatchResponseDataMessage

type EmailSendBatchResponseDataMessage struct {
	// Message identifier (token)
	ID string `json:"id,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailSendBatchResponseDataMessage) RawJSON

Returns the unmodified JSON received from the API

func (*EmailSendBatchResponseDataMessage) UnmarshalJSON

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

type EmailSendParams

type EmailSendParams struct {
	// Sender email address. Must be from a verified domain OR use sandbox mode.
	//
	// **Supported formats:**
	//
	// - Email only: `[email protected]`
	// - With display name: `Acme <[email protected]>`
	// - With quoted name: `"Acme Support" <[email protected]>`
	//
	// The domain portion must match a verified sending domain in your account.
	//
	// **Sandbox mode:** Use `[email protected]` to send test emails without domain
	// verification. Sandbox emails can only be sent to organization members and are
	// limited to 10 per day.
	From string `json:"from,required"`
	// Email subject line
	Subject string `json:"subject,required"`
	// Recipient email addresses (max 50)
	To []string `json:"to,omitzero,required" format:"email"`
	// HTML body content (accepts null). Maximum 5MB (5,242,880 characters). Combined
	// with attachments, the total message must not exceed 14MB.
	HTML param.Opt[string] `json:"html,omitzero"`
	// Reply-to address (accepts null)
	ReplyTo param.Opt[string] `json:"replyTo,omitzero" format:"email"`
	// Tag for categorization and filtering (accepts null)
	Tag param.Opt[string] `json:"tag,omitzero"`
	// Plain text body (accepts null, auto-generated from HTML if not provided).
	// Maximum 5MB (5,242,880 characters).
	Text           param.Opt[string] `json:"text,omitzero"`
	IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
	// File attachments (accepts null)
	Attachments []EmailSendParamsAttachment `json:"attachments,omitzero"`
	// BCC recipients (accepts null)
	Bcc []string `json:"bcc,omitzero" format:"email"`
	// CC recipients (accepts null)
	Cc []string `json:"cc,omitzero" format:"email"`
	// Custom email headers (accepts null)
	Headers map[string]string `json:"headers,omitzero"`
	// Custom key-value pairs attached to an email for webhook correlation.
	//
	// When you send an email with metadata, these key-value pairs are:
	//
	// - **Stored** with the message
	// - **Returned** in all webhook event payloads (MessageSent, MessageBounced, etc.)
	// - **Never visible** to email recipients
	//
	// This is useful for correlating webhook events with your internal systems (e.g.,
	// user IDs, order IDs, campaign identifiers).
	//
	// **Validation Rules:**
	//
	//   - Maximum 10 keys per email
	//   - Keys: 1-40 characters, must start with a letter, only alphanumeric and
	//     underscores (`^[a-zA-Z][a-zA-Z0-9_]*$`)
	//   - Values: 1-500 characters, no control characters (newlines, tabs, etc.)
	//   - Total size: 4KB maximum (JSON-encoded)
	Metadata map[string]string `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

func (EmailSendParams) MarshalJSON

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

func (*EmailSendParams) UnmarshalJSON

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

type EmailSendParamsAttachment

type EmailSendParamsAttachment struct {
	// Base64-encoded file content
	Content string `json:"content,required"`
	// MIME type
	ContentType string `json:"contentType,required"`
	// Attachment filename
	Filename string `json:"filename,required"`
	// contains filtered or unexported fields
}

The properties Content, ContentType, Filename are required.

func (EmailSendParamsAttachment) MarshalJSON

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

func (*EmailSendParamsAttachment) UnmarshalJSON

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

type EmailSendRawParams

type EmailSendRawParams struct {
	// Sender email address. Must be from a verified domain.
	//
	// **Supported formats:**
	//
	// - Email only: `[email protected]`
	// - With display name: `Acme <[email protected]>`
	// - With quoted name: `"Acme Support" <[email protected]>`
	//
	// The domain portion must match a verified sending domain in your account.
	From string `json:"from,required"`
	// Base64-encoded RFC 2822 MIME message.
	//
	// **You must base64-encode your raw email before sending.** The raw email should
	// include headers (From, To, Subject, Content-Type, etc.) followed by a blank line
	// and the message body.
	RawMessage string `json:"rawMessage,required"`
	// Recipient email addresses
	To []string `json:"to,omitzero,required" format:"email"`
	// Whether this is a bounce message (accepts null)
	Bounce param.Opt[bool] `json:"bounce,omitzero"`
	// contains filtered or unexported fields
}

func (EmailSendRawParams) MarshalJSON

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

func (*EmailSendRawParams) UnmarshalJSON

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

type EmailSendRawResponse added in v0.3.0

type EmailSendRawResponse struct {
	Data    EmailSendRawResponseData `json:"data,required"`
	Meta    shared.APIMeta           `json:"meta,required"`
	Success bool                     `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailSendRawResponse) RawJSON added in v0.3.0

func (r EmailSendRawResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailSendRawResponse) UnmarshalJSON added in v0.3.0

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

type EmailSendRawResponseData added in v0.3.0

type EmailSendRawResponseData struct {
	// Unique message identifier (token)
	ID string `json:"id,required"`
	// Current delivery status
	//
	// Any of "pending", "sent".
	Status string `json:"status,required"`
	// List of recipient addresses
	To []string `json:"to,required" format:"email"`
	// SMTP Message-ID header value
	MessageID string `json:"messageId"`
	// Whether this email was sent in sandbox mode. Only present (and true) for sandbox
	// emails sent from @arkhq.io addresses.
	Sandbox bool `json:"sandbox"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Status      respjson.Field
		To          respjson.Field
		MessageID   respjson.Field
		Sandbox     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailSendRawResponseData) RawJSON added in v0.3.0

func (r EmailSendRawResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailSendRawResponseData) UnmarshalJSON added in v0.3.0

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

type EmailSendResponse added in v0.3.0

type EmailSendResponse struct {
	Data    EmailSendResponseData `json:"data,required"`
	Meta    shared.APIMeta        `json:"meta,required"`
	Success bool                  `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailSendResponse) RawJSON added in v0.3.0

func (r EmailSendResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailSendResponse) UnmarshalJSON added in v0.3.0

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

type EmailSendResponseData added in v0.3.0

type EmailSendResponseData struct {
	// Unique message identifier (token)
	ID string `json:"id,required"`
	// Current delivery status
	//
	// Any of "pending", "sent".
	Status string `json:"status,required"`
	// List of recipient addresses
	To []string `json:"to,required" format:"email"`
	// SMTP Message-ID header value
	MessageID string `json:"messageId"`
	// Whether this email was sent in sandbox mode. Only present (and true) for sandbox
	// emails sent from @arkhq.io addresses.
	Sandbox bool `json:"sandbox"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Status      respjson.Field
		To          respjson.Field
		MessageID   respjson.Field
		Sandbox     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmailSendResponseData) RawJSON added in v0.3.0

func (r EmailSendResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmailSendResponseData) UnmarshalJSON added in v0.3.0

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

type EmailService

type EmailService struct {
	Options []option.RequestOption
}

EmailService contains methods and other services that help with interacting with the ark 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 NewEmailService method instead.

func NewEmailService

func NewEmailService(opts ...option.RequestOption) (r EmailService)

NewEmailService 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 (*EmailService) Get

func (r *EmailService) Get(ctx context.Context, emailID string, query EmailGetParams, opts ...option.RequestOption) (res *EmailGetResponse, err error)

Retrieve detailed information about a specific email including delivery status, timestamps, and optionally the email content.

Use the `expand` parameter to include additional data like the HTML/text body, headers, or delivery attempts.

func (*EmailService) GetDeliveries

func (r *EmailService) GetDeliveries(ctx context.Context, emailID string, opts ...option.RequestOption) (res *EmailGetDeliveriesResponse, err error)

Get the complete delivery history for an email, including SMTP response codes, timestamps, and current retry state.

## Response Fields

### Status

The current status of the email:

- `pending` - Awaiting first delivery attempt - `sent` - Successfully delivered to recipient server - `softfail` - Temporary failure, automatic retry scheduled - `hardfail` - Permanent failure, will not retry - `held` - Held for manual review - `bounced` - Bounced by recipient server

### Retry State

When the email is in the delivery queue (`pending` or `softfail` status), `retryState` provides information about the retry schedule:

- `attempt` - Current attempt number (0 = first attempt) - `maxAttempts` - Maximum attempts before hard-fail (typically 18) - `attemptsRemaining` - Attempts left before hard-fail - `nextRetryAt` - When the next retry is scheduled (Unix timestamp) - `processing` - Whether the email is currently being processed - `manual` - Whether this was triggered by a manual retry

When the email has finished processing (`sent`, `hardfail`, `held`, `bounced`), `retryState` is `null`.

### Can Retry Manually

Indicates whether you can call `POST /emails/{emailId}/retry` to manually retry the email. This is `true` when the raw message content is still available (not expired due to retention policy).

func (*EmailService) List

Retrieve a paginated list of sent emails. Results are ordered by send time, newest first.

Use filters to narrow down results by status, recipient, sender, or tag.

**Related endpoints:**

- `GET /emails/{emailId}` - Get full details of a specific email - `POST /emails` - Send a new email

func (*EmailService) ListAutoPaging added in v0.4.0

Retrieve a paginated list of sent emails. Results are ordered by send time, newest first.

Use filters to narrow down results by status, recipient, sender, or tag.

**Related endpoints:**

- `GET /emails/{emailId}` - Get full details of a specific email - `POST /emails` - Send a new email

func (*EmailService) Retry

func (r *EmailService) Retry(ctx context.Context, emailID string, opts ...option.RequestOption) (res *EmailRetryResponse, err error)

Retry delivery of a failed or soft-bounced email. Creates a new delivery attempt.

Only works for emails that have failed or are in a retryable state.

func (*EmailService) Send

func (r *EmailService) Send(ctx context.Context, params EmailSendParams, opts ...option.RequestOption) (res *EmailSendResponse, err error)

Send a single email message. The email is accepted for immediate delivery and typically delivered within seconds.

**Example use case:** Send a password reset email to a user.

**Required fields:** `from`, `to`, `subject`, and either `html` or `text`

**Idempotency:** Supports `Idempotency-Key` header for safe retries.

**Related endpoints:**

- `GET /emails/{emailId}` - Track delivery status - `GET /emails/{emailId}/deliveries` - View delivery attempts - `POST /emails/{emailId}/retry` - Retry failed delivery

func (*EmailService) SendBatch

func (r *EmailService) SendBatch(ctx context.Context, params EmailSendBatchParams, opts ...option.RequestOption) (res *EmailSendBatchResponse, err error)

Send up to 100 emails in a single request. Useful for sending personalized emails to multiple recipients efficiently.

Each email in the batch can have different content and recipients. Failed emails don't affect other emails in the batch.

**Idempotency:** Supports `Idempotency-Key` header for safe retries.

func (*EmailService) SendRaw

func (r *EmailService) SendRaw(ctx context.Context, body EmailSendRawParams, opts ...option.RequestOption) (res *EmailSendRawResponse, err error)

Send a pre-formatted RFC 2822 MIME message. Use this for advanced use cases or when migrating from systems that generate raw email content.

**Important:** The `rawMessage` field must be base64-encoded. Your raw MIME message (with headers like From, To, Subject, Content-Type, followed by a blank line and the body) must be encoded to base64 before sending.

type Error

type Error = apierror.Error

type LimitGetResponse added in v0.18.0

type LimitGetResponse struct {
	// Current usage and limit information
	Data    LimitsData     `json:"data,required"`
	Meta    shared.APIMeta `json:"meta,required"`
	Success bool           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Account rate limits and send limits response

func (LimitGetResponse) RawJSON added in v0.18.0

func (r LimitGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*LimitGetResponse) UnmarshalJSON added in v0.18.0

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

type LimitService added in v0.18.0

type LimitService struct {
	Options []option.RequestOption
}

LimitService contains methods and other services that help with interacting with the ark 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 NewLimitService method instead.

func NewLimitService added in v0.18.0

func NewLimitService(opts ...option.RequestOption) (r LimitService)

NewLimitService 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 (*LimitService) Get added in v0.18.0

func (r *LimitService) Get(ctx context.Context, opts ...option.RequestOption) (res *LimitGetResponse, err error)

Returns current rate limit and send limit information for your account.

This endpoint is the recommended way to check your account's operational limits. Use `/usage` endpoints for historical usage analytics.

**Response includes:**

- `rateLimit` - API request rate limit (requests per second) - `sendLimit` - Email sending limit (emails per hour) - `billing` - Credit balance and auto-recharge configuration

**Notes:**

- This request counts against your rate limit - `sendLimit` may be null if the service is temporarily unavailable - `billing` is null if billing is not configured - Send limit resets at the top of each hour

type LimitsData added in v0.18.0

type LimitsData struct {
	// Billing and credit information
	Billing LimitsDataBilling `json:"billing,required"`
	// API rate limit status
	RateLimit LimitsDataRateLimit `json:"rateLimit,required"`
	// Email send limit status (hourly cap)
	SendLimit LimitsDataSendLimit `json:"sendLimit,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Billing     respjson.Field
		RateLimit   respjson.Field
		SendLimit   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Current usage and limit information

func (LimitsData) RawJSON added in v0.18.0

func (r LimitsData) RawJSON() string

Returns the unmodified JSON received from the API

func (*LimitsData) UnmarshalJSON added in v0.18.0

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

type LimitsDataBilling added in v0.18.0

type LimitsDataBilling struct {
	// Auto-recharge configuration
	AutoRecharge LimitsDataBillingAutoRecharge `json:"autoRecharge,required"`
	// Current credit balance as formatted string (e.g., "25.50")
	CreditBalance string `json:"creditBalance,required"`
	// Current credit balance in cents for precise calculations
	CreditBalanceCents int64 `json:"creditBalanceCents,required"`
	// Whether a payment method is configured
	HasPaymentMethod bool `json:"hasPaymentMethod,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AutoRecharge       respjson.Field
		CreditBalance      respjson.Field
		CreditBalanceCents respjson.Field
		HasPaymentMethod   respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Billing and credit information

func (LimitsDataBilling) RawJSON added in v0.18.0

func (r LimitsDataBilling) RawJSON() string

Returns the unmodified JSON received from the API

func (*LimitsDataBilling) UnmarshalJSON added in v0.18.0

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

type LimitsDataBillingAutoRecharge added in v0.18.0

type LimitsDataBillingAutoRecharge struct {
	// Amount to recharge when triggered
	Amount string `json:"amount,required"`
	// Whether auto-recharge is enabled
	Enabled bool `json:"enabled,required"`
	// Balance threshold that triggers recharge
	Threshold string `json:"threshold,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount      respjson.Field
		Enabled     respjson.Field
		Threshold   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Auto-recharge configuration

func (LimitsDataBillingAutoRecharge) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*LimitsDataBillingAutoRecharge) UnmarshalJSON added in v0.18.0

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

type LimitsDataRateLimit added in v0.18.0

type LimitsDataRateLimit struct {
	// Maximum requests allowed per period
	Limit int64 `json:"limit,required"`
	// Time period for the limit
	//
	// Any of "second".
	Period string `json:"period,required"`
	// Requests remaining in current window
	Remaining int64 `json:"remaining,required"`
	// Unix timestamp when the limit resets
	Reset int64 `json:"reset,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Limit       respjson.Field
		Period      respjson.Field
		Remaining   respjson.Field
		Reset       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

API rate limit status

func (LimitsDataRateLimit) RawJSON added in v0.18.0

func (r LimitsDataRateLimit) RawJSON() string

Returns the unmodified JSON received from the API

func (*LimitsDataRateLimit) UnmarshalJSON added in v0.18.0

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

type LimitsDataSendLimit added in v0.18.0

type LimitsDataSendLimit struct {
	// Whether approaching the limit (>90%)
	Approaching bool `json:"approaching,required"`
	// Whether the limit has been exceeded
	Exceeded bool `json:"exceeded,required"`
	// Maximum emails allowed per hour (null = unlimited)
	Limit int64 `json:"limit,required"`
	// Time period for the limit
	//
	// Any of "hour".
	Period string `json:"period,required"`
	// Emails remaining in current period (null if unlimited)
	Remaining int64 `json:"remaining,required"`
	// ISO timestamp when the limit window resets (top of next hour)
	ResetsAt time.Time `json:"resetsAt,required" format:"date-time"`
	// Usage as a percentage (null if unlimited)
	UsagePercent float64 `json:"usagePercent,required"`
	// Emails sent in current period
	Used int64 `json:"used,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Approaching  respjson.Field
		Exceeded     respjson.Field
		Limit        respjson.Field
		Period       respjson.Field
		Remaining    respjson.Field
		ResetsAt     respjson.Field
		UsagePercent respjson.Field
		Used         respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Email send limit status (hourly cap)

func (LimitsDataSendLimit) RawJSON added in v0.18.0

func (r LimitsDataSendLimit) RawJSON() string

Returns the unmodified JSON received from the API

func (*LimitsDataSendLimit) UnmarshalJSON added in v0.18.0

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

type LogEntry added in v0.13.0

type LogEntry struct {
	// Request context information
	Context LogEntryContext `json:"context,required"`
	// API credential information
	Credential LogEntryCredential `json:"credential,required"`
	// Request duration in milliseconds
	DurationMs int64 `json:"durationMs,required"`
	// Semantic endpoint name
	Endpoint string `json:"endpoint,required"`
	// HTTP method
	//
	// Any of "GET", "POST", "PUT", "PATCH", "DELETE".
	Method LogEntryMethod `json:"method,required"`
	// Request path
	Path string `json:"path,required"`
	// Rate limit state at time of request
	RateLimit LogEntryRateLimit `json:"rateLimit,required"`
	// Unique request identifier
	RequestID string `json:"requestId,required"`
	// HTTP response status code
	StatusCode int64 `json:"statusCode,required"`
	// When the request was made (ISO 8601)
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Email-specific data (for email endpoints)
	Email LogEntryEmail `json:"email,nullable"`
	// Error details (null if request succeeded)
	Error LogEntryError `json:"error,nullable"`
	// SDK information (null if not using an SDK)
	SDK LogEntrySDK `json:"sdk,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Context     respjson.Field
		Credential  respjson.Field
		DurationMs  respjson.Field
		Endpoint    respjson.Field
		Method      respjson.Field
		Path        respjson.Field
		RateLimit   respjson.Field
		RequestID   respjson.Field
		StatusCode  respjson.Field
		Timestamp   respjson.Field
		Email       respjson.Field
		Error       respjson.Field
		SDK         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

API request log entry (list view)

func (LogEntry) RawJSON added in v0.13.0

func (r LogEntry) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogEntry) UnmarshalJSON added in v0.13.0

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

type LogEntryContext added in v0.13.0

type LogEntryContext struct {
	// Idempotency key if provided
	IdempotencyKey string `json:"idempotencyKey,nullable"`
	// Client IP address
	IPAddress string `json:"ipAddress,nullable"`
	// Query parameters
	QueryParams map[string]any `json:"queryParams,nullable"`
	// User-Agent header
	UserAgent string `json:"userAgent,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		IdempotencyKey respjson.Field
		IPAddress      respjson.Field
		QueryParams    respjson.Field
		UserAgent      respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Request context information

func (LogEntryContext) RawJSON added in v0.13.0

func (r LogEntryContext) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogEntryContext) UnmarshalJSON added in v0.13.0

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

type LogEntryCredential added in v0.13.0

type LogEntryCredential struct {
	// Credential ID
	ID string `json:"id,required"`
	// API key prefix (first 8 characters)
	KeyPrefix string `json:"keyPrefix,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		KeyPrefix   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

API credential information

func (LogEntryCredential) RawJSON added in v0.13.0

func (r LogEntryCredential) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogEntryCredential) UnmarshalJSON added in v0.13.0

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

type LogEntryDetail added in v0.13.0

type LogEntryDetail struct {
	// Request body information
	Request LogEntryDetailRequest `json:"request"`
	// Response body information
	Response LogEntryDetailResponse `json:"response"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Request     respjson.Field
		Response    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	LogEntry
}

Full API request log entry with bodies

func (LogEntryDetail) RawJSON added in v0.13.0

func (r LogEntryDetail) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogEntryDetail) UnmarshalJSON added in v0.13.0

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

type LogEntryDetailRequest added in v0.13.0

type LogEntryDetailRequest struct {
	// Decrypted request body (JSON or string). Bodies over 25KB are truncated.
	Body LogEntryDetailRequestBodyUnion `json:"body,nullable"`
	// Original request body size in bytes
	BodySize int64 `json:"bodySize,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Body        respjson.Field
		BodySize    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Request body information

func (LogEntryDetailRequest) RawJSON added in v0.13.0

func (r LogEntryDetailRequest) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogEntryDetailRequest) UnmarshalJSON added in v0.13.0

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

type LogEntryDetailRequestBodyUnion added in v0.13.0

type LogEntryDetailRequestBodyUnion struct {
	// This field will be present if the value is a [any] instead of an object.
	OfLogEntryDetailRequestBodyMapItem any `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	JSON     struct {
		OfLogEntryDetailRequestBodyMapItem respjson.Field
		OfString                           respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

LogEntryDetailRequestBodyUnion contains all possible properties and values from [map[string]any], [string].

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

If the underlying value is not a json object, one of the following properties will be valid: OfLogEntryDetailRequestBodyMapItem OfString]

func (LogEntryDetailRequestBodyUnion) AsAnyMap added in v0.13.0

func (u LogEntryDetailRequestBodyUnion) AsAnyMap() (v map[string]any)

func (LogEntryDetailRequestBodyUnion) AsString added in v0.13.0

func (u LogEntryDetailRequestBodyUnion) AsString() (v string)

func (LogEntryDetailRequestBodyUnion) RawJSON added in v0.13.0

Returns the unmodified JSON received from the API

func (*LogEntryDetailRequestBodyUnion) UnmarshalJSON added in v0.13.0

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

type LogEntryDetailResponse added in v0.13.0

type LogEntryDetailResponse struct {
	// Decrypted response body (JSON or string). Bodies over 25KB are truncated.
	Body LogEntryDetailResponseBodyUnion `json:"body,nullable"`
	// Response body size in bytes
	BodySize int64 `json:"bodySize,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Body        respjson.Field
		BodySize    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response body information

func (LogEntryDetailResponse) RawJSON added in v0.13.0

func (r LogEntryDetailResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogEntryDetailResponse) UnmarshalJSON added in v0.13.0

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

type LogEntryDetailResponseBodyUnion added in v0.13.0

type LogEntryDetailResponseBodyUnion struct {
	// This field will be present if the value is a [any] instead of an object.
	OfLogEntryDetailResponseBodyMapItem any `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	JSON     struct {
		OfLogEntryDetailResponseBodyMapItem respjson.Field
		OfString                            respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

LogEntryDetailResponseBodyUnion contains all possible properties and values from [map[string]any], [string].

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

If the underlying value is not a json object, one of the following properties will be valid: OfLogEntryDetailResponseBodyMapItem OfString]

func (LogEntryDetailResponseBodyUnion) AsAnyMap added in v0.13.0

func (u LogEntryDetailResponseBodyUnion) AsAnyMap() (v map[string]any)

func (LogEntryDetailResponseBodyUnion) AsString added in v0.13.0

func (u LogEntryDetailResponseBodyUnion) AsString() (v string)

func (LogEntryDetailResponseBodyUnion) RawJSON added in v0.13.0

Returns the unmodified JSON received from the API

func (*LogEntryDetailResponseBodyUnion) UnmarshalJSON added in v0.13.0

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

type LogEntryEmail added in v0.13.0

type LogEntryEmail struct {
	// Email message identifier (token)
	ID string `json:"id"`
	// Number of recipients
	RecipientCount int64 `json:"recipientCount,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID             respjson.Field
		RecipientCount respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Email-specific data (for email endpoints)

func (LogEntryEmail) RawJSON added in v0.13.0

func (r LogEntryEmail) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogEntryEmail) UnmarshalJSON added in v0.13.0

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

type LogEntryError added in v0.13.0

type LogEntryError struct {
	// Error code
	Code string `json:"code"`
	// Error message
	Message string `json:"message,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Code        respjson.Field
		Message     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Error details (null if request succeeded)

func (LogEntryError) RawJSON added in v0.13.0

func (r LogEntryError) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogEntryError) UnmarshalJSON added in v0.13.0

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

type LogEntryMethod added in v0.13.0

type LogEntryMethod string

HTTP method

const (
	LogEntryMethodGet    LogEntryMethod = "GET"
	LogEntryMethodPost   LogEntryMethod = "POST"
	LogEntryMethodPut    LogEntryMethod = "PUT"
	LogEntryMethodPatch  LogEntryMethod = "PATCH"
	LogEntryMethodDelete LogEntryMethod = "DELETE"
)

type LogEntryRateLimit added in v0.13.0

type LogEntryRateLimit struct {
	// Rate limit ceiling
	Limit int64 `json:"limit,nullable"`
	// Whether the request was rate limited
	Limited bool `json:"limited"`
	// Remaining requests in window
	Remaining int64 `json:"remaining,nullable"`
	// Unix timestamp when limit resets
	Reset int64 `json:"reset,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Limit       respjson.Field
		Limited     respjson.Field
		Remaining   respjson.Field
		Reset       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Rate limit state at time of request

func (LogEntryRateLimit) RawJSON added in v0.13.0

func (r LogEntryRateLimit) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogEntryRateLimit) UnmarshalJSON added in v0.13.0

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

type LogEntrySDK added in v0.13.0

type LogEntrySDK struct {
	// SDK name
	Name string `json:"name"`
	// SDK version
	Version string `json:"version,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name        respjson.Field
		Version     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

SDK information (null if not using an SDK)

func (LogEntrySDK) RawJSON added in v0.13.0

func (r LogEntrySDK) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogEntrySDK) UnmarshalJSON added in v0.13.0

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

type LogGetResponse added in v0.13.0

type LogGetResponse struct {
	// Full API request log entry with bodies
	Data    LogEntryDetail `json:"data,required"`
	Meta    shared.APIMeta `json:"meta,required"`
	Success bool           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Detailed API request log with request/response bodies

func (LogGetResponse) RawJSON added in v0.13.0

func (r LogGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogGetResponse) UnmarshalJSON added in v0.13.0

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

type LogListParams added in v0.13.0

type LogListParams struct {
	// Filter by API credential ID
	CredentialID param.Opt[string] `query:"credentialId,omitzero" json:"-"`
	// Filter logs before this date (ISO 8601 format)
	EndDate param.Opt[time.Time] `query:"endDate,omitzero" format:"date-time" json:"-"`
	// Filter by endpoint name
	Endpoint param.Opt[string] `query:"endpoint,omitzero" json:"-"`
	// Page number
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Results per page (max 100)
	PerPage param.Opt[int64] `query:"perPage,omitzero" json:"-"`
	// Filter by request ID (partial match)
	RequestID param.Opt[string] `query:"requestId,omitzero" json:"-"`
	// Filter logs after this date (ISO 8601 format)
	StartDate param.Opt[time.Time] `query:"startDate,omitzero" format:"date-time" json:"-"`
	// Filter by exact HTTP status code (100-599)
	StatusCode param.Opt[int64] `query:"statusCode,omitzero" json:"-"`
	// Filter by status category:
	//
	// - `success` - Status codes < 400
	// - `error` - Status codes >= 400
	//
	// Any of "success", "error".
	Status LogListParamsStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (LogListParams) URLQuery added in v0.13.0

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

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

type LogListParamsStatus added in v0.13.0

type LogListParamsStatus string

Filter by status category:

- `success` - Status codes < 400 - `error` - Status codes >= 400

const (
	LogListParamsStatusSuccess LogListParamsStatus = "success"
	LogListParamsStatusError   LogListParamsStatus = "error"
)

type LogService added in v0.13.0

type LogService struct {
	Options []option.RequestOption
}

LogService contains methods and other services that help with interacting with the ark 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 NewLogService method instead.

func NewLogService added in v0.13.0

func NewLogService(opts ...option.RequestOption) (r LogService)

NewLogService 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 (*LogService) Get added in v0.13.0

func (r *LogService) Get(ctx context.Context, requestID string, opts ...option.RequestOption) (res *LogGetResponse, err error)

Retrieve detailed information about a specific API request log, including the full request and response bodies.

**Body decryption:** Request and response bodies are stored encrypted and automatically decrypted when retrieved. Bodies larger than 25KB are truncated at storage time with a `... [truncated]` marker.

**Use cases:**

- Debug a specific failed request - Review the exact payload sent/received - Share request details with support

**Related endpoints:**

- `GET /logs` - List logs with filters

func (*LogService) List added in v0.13.0

Retrieve a paginated list of API request logs for debugging and monitoring. Results are ordered by timestamp, newest first.

**Use cases:**

- Debug integration issues by reviewing recent requests - Monitor error rates and response times - Audit API usage patterns

**Filters:**

- `status` - Filter by success or error category - `statusCode` - Filter by exact HTTP status code - `endpoint` - Filter by endpoint name (e.g., `emails.send`) - `credentialId` - Filter by API key - `startDate`/`endDate` - Filter by date range

**Note:** Request and response bodies are only included when retrieving a single log entry with `GET /logs/{requestId}`.

**Related endpoints:**

- `GET /logs/{requestId}` - Get full log details with request/response bodies

func (*LogService) ListAutoPaging added in v0.13.0

Retrieve a paginated list of API request logs for debugging and monitoring. Results are ordered by timestamp, newest first.

**Use cases:**

- Debug integration issues by reviewing recent requests - Monitor error rates and response times - Audit API usage patterns

**Filters:**

- `status` - Filter by success or error category - `statusCode` - Filter by exact HTTP status code - `endpoint` - Filter by endpoint name (e.g., `emails.send`) - `credentialId` - Filter by API key - `startDate`/`endDate` - Filter by date range

**Note:** Request and response bodies are only included when retrieving a single log entry with `GET /logs/{requestId}`.

**Related endpoints:**

- `GET /logs/{requestId}` - Get full log details with request/response bodies

type OrgUsageSummary added in v0.18.0

type OrgUsageSummary struct {
	Data    OrgUsageSummaryData `json:"data,required"`
	Meta    shared.APIMeta      `json:"meta,required"`
	Success bool                `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Org-wide usage summary response

func (OrgUsageSummary) RawJSON added in v0.18.0

func (r OrgUsageSummary) RawJSON() string

Returns the unmodified JSON received from the API

func (*OrgUsageSummary) UnmarshalJSON added in v0.18.0

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

type OrgUsageSummaryData added in v0.18.0

type OrgUsageSummaryData struct {
	// Email delivery counts
	Emails EmailCounts `json:"emails,required"`
	// Time period for usage data
	Period UsagePeriod `json:"period,required"`
	// Email delivery rates (as decimals, e.g., 0.95 = 95%)
	Rates   EmailRates                 `json:"rates,required"`
	Tenants OrgUsageSummaryDataTenants `json:"tenants,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Emails      respjson.Field
		Period      respjson.Field
		Rates       respjson.Field
		Tenants     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OrgUsageSummaryData) RawJSON added in v0.18.0

func (r OrgUsageSummaryData) RawJSON() string

Returns the unmodified JSON received from the API

func (*OrgUsageSummaryData) UnmarshalJSON added in v0.18.0

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

type OrgUsageSummaryDataTenants added in v0.18.0

type OrgUsageSummaryDataTenants struct {
	// Number of active tenants
	Active int64 `json:"active,required"`
	// Total number of tenants
	Total int64 `json:"total,required"`
	// Number of tenants with sending activity
	WithActivity int64 `json:"withActivity,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Active       respjson.Field
		Total        respjson.Field
		WithActivity respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OrgUsageSummaryDataTenants) RawJSON added in v0.18.0

func (r OrgUsageSummaryDataTenants) RawJSON() string

Returns the unmodified JSON received from the API

func (*OrgUsageSummaryDataTenants) UnmarshalJSON added in v0.18.0

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

type PlatformService added in v0.18.0

type PlatformService struct {
	Options  []option.RequestOption
	Webhooks PlatformWebhookService
}

PlatformService contains methods and other services that help with interacting with the ark 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 NewPlatformService method instead.

func NewPlatformService added in v0.18.0

func NewPlatformService(opts ...option.RequestOption) (r PlatformService)

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

type PlatformWebhookDeleteResponse added in v0.18.0

type PlatformWebhookDeleteResponse struct {
	Data    PlatformWebhookDeleteResponseData `json:"data,required"`
	Meta    shared.APIMeta                    `json:"meta,required"`
	Success bool                              `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookDeleteResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookDeleteResponse) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookDeleteResponseData added in v0.18.0

type PlatformWebhookDeleteResponseData struct {
	Message string `json:"message,required"`
	// 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 (PlatformWebhookDeleteResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookDeleteResponseData) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookGetDeliveryResponse added in v0.18.0

type PlatformWebhookGetDeliveryResponse struct {
	Data    PlatformWebhookGetDeliveryResponseData `json:"data,required"`
	Meta    shared.APIMeta                         `json:"meta,required"`
	Success bool                                   `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookGetDeliveryResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookGetDeliveryResponse) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookGetDeliveryResponseData added in v0.18.0

type PlatformWebhookGetDeliveryResponseData struct {
	// Unique delivery ID
	ID string `json:"id,required"`
	// Attempt number
	Attempt int64 `json:"attempt,required"`
	// Event type
	Event string `json:"event,required"`
	// Request details
	Request PlatformWebhookGetDeliveryResponseDataRequest `json:"request,required"`
	// Response details
	Response PlatformWebhookGetDeliveryResponseDataResponse `json:"response,required"`
	// HTTP status code from your endpoint
	StatusCode int64 `json:"statusCode,required"`
	// Whether delivery was successful
	Success bool `json:"success,required"`
	// Tenant that triggered the event
	TenantID string `json:"tenantId,required"`
	// When delivery was attempted
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Endpoint URL
	URL string `json:"url,required" format:"uri"`
	// Platform webhook ID
	WebhookID string `json:"webhookId,required"`
	// Platform webhook name
	WebhookName string `json:"webhookName,required"`
	// Whether this will be retried
	WillRetry bool `json:"willRetry,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Attempt     respjson.Field
		Event       respjson.Field
		Request     respjson.Field
		Response    respjson.Field
		StatusCode  respjson.Field
		Success     respjson.Field
		TenantID    respjson.Field
		Timestamp   respjson.Field
		URL         respjson.Field
		WebhookID   respjson.Field
		WebhookName respjson.Field
		WillRetry   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookGetDeliveryResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookGetDeliveryResponseData) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookGetDeliveryResponseDataRequest added in v0.18.0

type PlatformWebhookGetDeliveryResponseDataRequest struct {
	// Request headers including signature
	Headers map[string]string `json:"headers"`
	// The complete webhook payload that was sent
	Payload map[string]any `json:"payload"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Headers     respjson.Field
		Payload     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Request details

func (PlatformWebhookGetDeliveryResponseDataRequest) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookGetDeliveryResponseDataRequest) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookGetDeliveryResponseDataResponse added in v0.18.0

type PlatformWebhookGetDeliveryResponseDataResponse struct {
	// Response body (truncated if too large)
	Body string `json:"body,nullable"`
	// Response time in milliseconds
	Duration int64 `json:"duration"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Body        respjson.Field
		Duration    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response details

func (PlatformWebhookGetDeliveryResponseDataResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookGetDeliveryResponseDataResponse) UnmarshalJSON added in v0.18.0

type PlatformWebhookGetResponse added in v0.18.0

type PlatformWebhookGetResponse struct {
	Data    PlatformWebhookGetResponseData `json:"data,required"`
	Meta    shared.APIMeta                 `json:"meta,required"`
	Success bool                           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookGetResponse) RawJSON added in v0.18.0

func (r PlatformWebhookGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PlatformWebhookGetResponse) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookGetResponseData added in v0.18.0

type PlatformWebhookGetResponseData struct {
	// Platform webhook ID
	ID        string    `json:"id,required"`
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// Whether the webhook is active
	Enabled bool `json:"enabled,required"`
	// Subscribed events (empty = all events)
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Events []string `json:"events,required"`
	// Webhook name for identification
	Name      string    `json:"name,required"`
	UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
	// Webhook endpoint URL
	URL string `json:"url,required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Enabled     respjson.Field
		Events      respjson.Field
		Name        respjson.Field
		UpdatedAt   respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookGetResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookGetResponseData) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookListDeliveriesParams added in v0.18.0

type PlatformWebhookListDeliveriesParams struct {
	// Only deliveries after this Unix timestamp
	After param.Opt[int64] `query:"after,omitzero" json:"-"`
	// Only deliveries before this Unix timestamp
	Before param.Opt[int64] `query:"before,omitzero" json:"-"`
	// Page number (default 1)
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Items per page (default 30, max 100)
	PerPage param.Opt[int64] `query:"perPage,omitzero" json:"-"`
	// Filter by delivery success
	Success param.Opt[bool] `query:"success,omitzero" json:"-"`
	// Filter by tenant ID
	TenantID param.Opt[string] `query:"tenantId,omitzero" json:"-"`
	// Filter by platform webhook ID
	WebhookID param.Opt[string] `query:"webhookId,omitzero" json:"-"`
	// Filter by event type
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Event PlatformWebhookListDeliveriesParamsEvent `query:"event,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PlatformWebhookListDeliveriesParams) URLQuery added in v0.18.0

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

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

type PlatformWebhookListDeliveriesParamsEvent added in v0.18.0

type PlatformWebhookListDeliveriesParamsEvent string

Filter by event type

const (
	PlatformWebhookListDeliveriesParamsEventMessageSent           PlatformWebhookListDeliveriesParamsEvent = "MessageSent"
	PlatformWebhookListDeliveriesParamsEventMessageDelayed        PlatformWebhookListDeliveriesParamsEvent = "MessageDelayed"
	PlatformWebhookListDeliveriesParamsEventMessageDeliveryFailed PlatformWebhookListDeliveriesParamsEvent = "MessageDeliveryFailed"
	PlatformWebhookListDeliveriesParamsEventMessageHeld           PlatformWebhookListDeliveriesParamsEvent = "MessageHeld"
	PlatformWebhookListDeliveriesParamsEventMessageBounced        PlatformWebhookListDeliveriesParamsEvent = "MessageBounced"
	PlatformWebhookListDeliveriesParamsEventMessageLinkClicked    PlatformWebhookListDeliveriesParamsEvent = "MessageLinkClicked"
	PlatformWebhookListDeliveriesParamsEventMessageLoaded         PlatformWebhookListDeliveriesParamsEvent = "MessageLoaded"
	PlatformWebhookListDeliveriesParamsEventDomainDNSError        PlatformWebhookListDeliveriesParamsEvent = "DomainDNSError"
)

type PlatformWebhookListDeliveriesResponse added in v0.18.0

type PlatformWebhookListDeliveriesResponse struct {
	// Unique delivery ID
	ID string `json:"id,required"`
	// Attempt number (1 for first attempt, higher for retries)
	Attempt int64 `json:"attempt,required"`
	// Event type
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Event PlatformWebhookListDeliveriesResponseEvent `json:"event,required"`
	// HTTP status code returned by your endpoint (null if connection failed)
	StatusCode int64 `json:"statusCode,required"`
	// Whether delivery was successful (2xx response)
	Success bool `json:"success,required"`
	// Tenant that triggered the event
	TenantID string `json:"tenantId,required"`
	// When the delivery was attempted
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Endpoint URL the delivery was sent to
	URL string `json:"url,required" format:"uri"`
	// Platform webhook ID
	WebhookID string `json:"webhookId,required"`
	// Whether this delivery will be retried
	WillRetry bool `json:"willRetry,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Attempt     respjson.Field
		Event       respjson.Field
		StatusCode  respjson.Field
		Success     respjson.Field
		TenantID    respjson.Field
		Timestamp   respjson.Field
		URL         respjson.Field
		WebhookID   respjson.Field
		WillRetry   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Summary of a platform webhook delivery attempt

func (PlatformWebhookListDeliveriesResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookListDeliveriesResponse) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookListDeliveriesResponseEvent added in v0.18.0

type PlatformWebhookListDeliveriesResponseEvent string

Event type

const (
	PlatformWebhookListDeliveriesResponseEventMessageSent           PlatformWebhookListDeliveriesResponseEvent = "MessageSent"
	PlatformWebhookListDeliveriesResponseEventMessageDelayed        PlatformWebhookListDeliveriesResponseEvent = "MessageDelayed"
	PlatformWebhookListDeliveriesResponseEventMessageDeliveryFailed PlatformWebhookListDeliveriesResponseEvent = "MessageDeliveryFailed"
	PlatformWebhookListDeliveriesResponseEventMessageHeld           PlatformWebhookListDeliveriesResponseEvent = "MessageHeld"
	PlatformWebhookListDeliveriesResponseEventMessageBounced        PlatformWebhookListDeliveriesResponseEvent = "MessageBounced"
	PlatformWebhookListDeliveriesResponseEventMessageLinkClicked    PlatformWebhookListDeliveriesResponseEvent = "MessageLinkClicked"
	PlatformWebhookListDeliveriesResponseEventMessageLoaded         PlatformWebhookListDeliveriesResponseEvent = "MessageLoaded"
	PlatformWebhookListDeliveriesResponseEventDomainDNSError        PlatformWebhookListDeliveriesResponseEvent = "DomainDNSError"
)

type PlatformWebhookListResponse added in v0.18.0

type PlatformWebhookListResponse struct {
	Data    []PlatformWebhookListResponseData `json:"data,required"`
	Meta    shared.APIMeta                    `json:"meta,required"`
	Success bool                              `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookListResponse) RawJSON added in v0.18.0

func (r PlatformWebhookListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PlatformWebhookListResponse) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookListResponseData added in v0.18.0

type PlatformWebhookListResponseData struct {
	// Platform webhook ID
	ID        string    `json:"id,required"`
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	Enabled   bool      `json:"enabled,required"`
	Events    []string  `json:"events,required"`
	Name      string    `json:"name,required"`
	URL       string    `json:"url,required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Enabled     respjson.Field
		Events      respjson.Field
		Name        respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookListResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookListResponseData) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookNewParams added in v0.18.0

type PlatformWebhookNewParams struct {
	// Display name for the webhook
	Name string `json:"name,required"`
	// Webhook endpoint URL (must be HTTPS)
	URL string `json:"url,required" format:"uri"`
	// Events to subscribe to. Empty array means all events.
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Events []string `json:"events,omitzero"`
	// contains filtered or unexported fields
}

func (PlatformWebhookNewParams) MarshalJSON added in v0.18.0

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

func (*PlatformWebhookNewParams) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookNewResponse added in v0.18.0

type PlatformWebhookNewResponse struct {
	Data    PlatformWebhookNewResponseData `json:"data,required"`
	Meta    shared.APIMeta                 `json:"meta,required"`
	Success bool                           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookNewResponse) RawJSON added in v0.18.0

func (r PlatformWebhookNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PlatformWebhookNewResponse) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookNewResponseData added in v0.18.0

type PlatformWebhookNewResponseData struct {
	// Platform webhook ID
	ID        string    `json:"id,required"`
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// Whether the webhook is active
	Enabled bool `json:"enabled,required"`
	// Subscribed events (empty = all events)
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Events []string `json:"events,required"`
	// Webhook name for identification
	Name      string    `json:"name,required"`
	UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
	// Webhook endpoint URL
	URL string `json:"url,required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Enabled     respjson.Field
		Events      respjson.Field
		Name        respjson.Field
		UpdatedAt   respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookNewResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookNewResponseData) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookReplayDeliveryResponse added in v0.18.0

type PlatformWebhookReplayDeliveryResponse struct {
	Data    PlatformWebhookReplayDeliveryResponseData `json:"data,required"`
	Meta    shared.APIMeta                            `json:"meta,required"`
	Success bool                                      `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Result of replaying a platform webhook delivery

func (PlatformWebhookReplayDeliveryResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookReplayDeliveryResponse) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookReplayDeliveryResponseData added in v0.18.0

type PlatformWebhookReplayDeliveryResponseData struct {
	// Request duration in milliseconds
	Duration int64 `json:"duration,required"`
	// ID of the new delivery created by the replay
	NewDeliveryID string `json:"newDeliveryId,required"`
	// ID of the original delivery that was replayed
	OriginalDeliveryID string `json:"originalDeliveryId,required"`
	// HTTP status code from your endpoint
	StatusCode int64 `json:"statusCode,required"`
	// Whether the replay was successful
	Success bool `json:"success,required"`
	// When the replay was executed
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Duration           respjson.Field
		NewDeliveryID      respjson.Field
		OriginalDeliveryID respjson.Field
		StatusCode         respjson.Field
		Success            respjson.Field
		Timestamp          respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookReplayDeliveryResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookReplayDeliveryResponseData) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookService added in v0.18.0

type PlatformWebhookService struct {
	Options []option.RequestOption
}

PlatformWebhookService contains methods and other services that help with interacting with the ark 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 NewPlatformWebhookService method instead.

func NewPlatformWebhookService added in v0.18.0

func NewPlatformWebhookService(opts ...option.RequestOption) (r PlatformWebhookService)

NewPlatformWebhookService 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 (*PlatformWebhookService) Delete added in v0.18.0

Delete a platform webhook. This stops all event delivery to the webhook URL. This action cannot be undone.

func (*PlatformWebhookService) Get added in v0.18.0

Get detailed information about a specific platform webhook.

func (*PlatformWebhookService) GetDelivery added in v0.18.0

func (r *PlatformWebhookService) GetDelivery(ctx context.Context, deliveryID string, opts ...option.RequestOption) (res *PlatformWebhookGetDeliveryResponse, err error)

Get detailed information about a specific platform webhook delivery.

Returns the complete request payload, headers, response, and timing info.

func (*PlatformWebhookService) List added in v0.18.0

Get all platform webhook endpoints configured for your organization.

Platform webhooks receive events from **all tenants** in your organization, unlike tenant webhooks which only receive events for a specific tenant. This is useful for centralized event processing and monitoring.

func (*PlatformWebhookService) ListDeliveries added in v0.18.0

Get a paginated list of platform webhook delivery attempts.

Filter by:

- `webhookId` - Specific webhook - `tenantId` - Specific tenant - `event` - Specific event type - `success` - Successful (2xx) or failed deliveries - `before`/`after` - Time range (Unix timestamps)

Deliveries are returned in reverse chronological order.

func (*PlatformWebhookService) ListDeliveriesAutoPaging added in v0.18.0

Get a paginated list of platform webhook delivery attempts.

Filter by:

- `webhookId` - Specific webhook - `tenantId` - Specific tenant - `event` - Specific event type - `success` - Successful (2xx) or failed deliveries - `before`/`after` - Time range (Unix timestamps)

Deliveries are returned in reverse chronological order.

func (*PlatformWebhookService) New added in v0.18.0

Create a platform webhook to receive email event notifications from all tenants.

Platform webhooks receive events from **all tenants** in your organization. Each webhook payload includes a `tenant_id` field to identify which tenant the event belongs to.

**Available events:**

- `MessageSent` - Email accepted by recipient server - `MessageDeliveryFailed` - Delivery permanently failed - `MessageDelayed` - Delivery temporarily failed, will retry - `MessageBounced` - Email bounced - `MessageHeld` - Email held for review - `MessageLinkClicked` - Recipient clicked a link - `MessageLoaded` - Recipient opened the email - `DomainDNSError` - Domain DNS issue detected

**Webhook payload includes:**

- `event` - The event type - `tenant_id` - The tenant that sent the email - `timestamp` - Unix timestamp of the event - `payload` - Event-specific data (message details, status, etc.)

func (*PlatformWebhookService) ReplayDelivery added in v0.18.0

func (r *PlatformWebhookService) ReplayDelivery(ctx context.Context, deliveryID string, opts ...option.RequestOption) (res *PlatformWebhookReplayDeliveryResponse, err error)

Replay a previous platform webhook delivery.

This re-sends the original payload with a new timestamp and delivery ID. Useful for recovering from temporary endpoint failures.

func (*PlatformWebhookService) Test added in v0.18.0

Send a test payload to your platform webhook endpoint.

Use this to:

- Verify your webhook URL is accessible - Test your payload handling code - Ensure your server responds correctly

The test payload is marked with `_test: true` so you can distinguish test events from real events.

func (*PlatformWebhookService) Update added in v0.18.0

Update a platform webhook's configuration.

You can update:

- `name` - Display name for the webhook - `url` - The endpoint URL (must be HTTPS) - `events` - Array of event types to receive (empty array = all events) - `enabled` - Enable or disable the webhook

type PlatformWebhookTestParams added in v0.18.0

type PlatformWebhookTestParams struct {
	// Event type to simulate
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Event PlatformWebhookTestParamsEvent `json:"event,omitzero,required"`
	// contains filtered or unexported fields
}

func (PlatformWebhookTestParams) MarshalJSON added in v0.18.0

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

func (*PlatformWebhookTestParams) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookTestParamsEvent added in v0.18.0

type PlatformWebhookTestParamsEvent string

Event type to simulate

const (
	PlatformWebhookTestParamsEventMessageSent           PlatformWebhookTestParamsEvent = "MessageSent"
	PlatformWebhookTestParamsEventMessageDelayed        PlatformWebhookTestParamsEvent = "MessageDelayed"
	PlatformWebhookTestParamsEventMessageDeliveryFailed PlatformWebhookTestParamsEvent = "MessageDeliveryFailed"
	PlatformWebhookTestParamsEventMessageHeld           PlatformWebhookTestParamsEvent = "MessageHeld"
	PlatformWebhookTestParamsEventMessageBounced        PlatformWebhookTestParamsEvent = "MessageBounced"
	PlatformWebhookTestParamsEventMessageLinkClicked    PlatformWebhookTestParamsEvent = "MessageLinkClicked"
	PlatformWebhookTestParamsEventMessageLoaded         PlatformWebhookTestParamsEvent = "MessageLoaded"
	PlatformWebhookTestParamsEventDomainDNSError        PlatformWebhookTestParamsEvent = "DomainDNSError"
)

type PlatformWebhookTestResponse added in v0.18.0

type PlatformWebhookTestResponse struct {
	Data    PlatformWebhookTestResponseData `json:"data,required"`
	Meta    shared.APIMeta                  `json:"meta,required"`
	Success bool                            `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookTestResponse) RawJSON added in v0.18.0

func (r PlatformWebhookTestResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PlatformWebhookTestResponse) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookTestResponseData added in v0.18.0

type PlatformWebhookTestResponseData struct {
	// Request duration in milliseconds
	DurationMs int64 `json:"durationMs,required"`
	// HTTP status code from the webhook endpoint
	StatusCode int64 `json:"statusCode,required"`
	// Whether the webhook endpoint responded with a 2xx status
	Success bool `json:"success,required"`
	// Error message if the request failed
	Error string `json:"error,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationMs  respjson.Field
		StatusCode  respjson.Field
		Success     respjson.Field
		Error       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookTestResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookTestResponseData) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookUpdateParams added in v0.18.0

type PlatformWebhookUpdateParams struct {
	// Enable or disable the webhook
	Enabled param.Opt[bool] `json:"enabled,omitzero"`
	// Display name for the webhook
	Name param.Opt[string] `json:"name,omitzero"`
	// Webhook endpoint URL (must be HTTPS)
	URL param.Opt[string] `json:"url,omitzero" format:"uri"`
	// Events to subscribe to. Empty array means all events.
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Events []string `json:"events,omitzero"`
	// contains filtered or unexported fields
}

func (PlatformWebhookUpdateParams) MarshalJSON added in v0.18.0

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

func (*PlatformWebhookUpdateParams) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookUpdateResponse added in v0.18.0

type PlatformWebhookUpdateResponse struct {
	Data    PlatformWebhookUpdateResponseData `json:"data,required"`
	Meta    shared.APIMeta                    `json:"meta,required"`
	Success bool                              `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookUpdateResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookUpdateResponse) UnmarshalJSON added in v0.18.0

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

type PlatformWebhookUpdateResponseData added in v0.18.0

type PlatformWebhookUpdateResponseData struct {
	// Platform webhook ID
	ID        string    `json:"id,required"`
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// Whether the webhook is active
	Enabled bool `json:"enabled,required"`
	// Subscribed events (empty = all events)
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Events []string `json:"events,required"`
	// Webhook name for identification
	Name      string    `json:"name,required"`
	UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
	// Webhook endpoint URL
	URL string `json:"url,required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Enabled     respjson.Field
		Events      respjson.Field
		Name        respjson.Field
		UpdatedAt   respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlatformWebhookUpdateResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*PlatformWebhookUpdateResponseData) UnmarshalJSON added in v0.18.0

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

type Tenant added in v0.17.0

type Tenant struct {
	// Unique identifier for the tenant
	ID string `json:"id,required"`
	// When the tenant was created
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// Custom key-value pairs for storing additional data
	Metadata map[string]TenantMetadataUnion `json:"metadata,required"`
	// Display name for the tenant
	Name string `json:"name,required"`
	// Current status of the tenant:
	//
	// - `active` - Normal operation
	// - `suspended` - Temporarily disabled
	// - `archived` - Soft-deleted
	//
	// Any of "active", "suspended", "archived".
	Status TenantStatus `json:"status,required"`
	// When the tenant was last updated
	UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Metadata    respjson.Field
		Name        respjson.Field
		Status      respjson.Field
		UpdatedAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Tenant) RawJSON added in v0.17.0

func (r Tenant) RawJSON() string

Returns the unmodified JSON received from the API

func (*Tenant) UnmarshalJSON added in v0.17.0

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

type TenantCredentialDeleteParams added in v0.18.0

type TenantCredentialDeleteParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// contains filtered or unexported fields
}

type TenantCredentialDeleteResponse added in v0.18.0

type TenantCredentialDeleteResponse struct {
	Data    TenantCredentialDeleteResponseData `json:"data,required"`
	Meta    shared.APIMeta                     `json:"meta,required"`
	Success bool                               `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantCredentialDeleteResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantCredentialDeleteResponse) UnmarshalJSON added in v0.18.0

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

type TenantCredentialDeleteResponseData added in v0.18.0

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

func (TenantCredentialDeleteResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantCredentialDeleteResponseData) UnmarshalJSON added in v0.18.0

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

type TenantCredentialGetParams added in v0.18.0

type TenantCredentialGetParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// Set to `true` to include the credential key in the response
	Reveal param.Opt[bool] `query:"reveal,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TenantCredentialGetParams) URLQuery added in v0.18.0

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

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

type TenantCredentialGetResponse added in v0.18.0

type TenantCredentialGetResponse struct {
	Data    TenantCredentialGetResponseData `json:"data,required"`
	Meta    shared.APIMeta                  `json:"meta,required"`
	Success bool                            `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantCredentialGetResponse) RawJSON added in v0.18.0

func (r TenantCredentialGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantCredentialGetResponse) UnmarshalJSON added in v0.18.0

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

type TenantCredentialGetResponseData added in v0.18.0

type TenantCredentialGetResponseData struct {
	// Unique identifier for the credential
	ID int64 `json:"id,required"`
	// When the credential was created
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// Whether the credential is on hold (disabled). When `true`, the credential cannot
	// be used to send emails.
	Hold bool `json:"hold,required"`
	// When the credential was last used to send an email
	LastUsedAt time.Time `json:"lastUsedAt,required" format:"date-time"`
	// Name of the credential
	Name string `json:"name,required"`
	// Type of credential:
	//
	// - `smtp` - For SMTP-based email sending
	// - `api` - For API-based email sending
	//
	// Any of "smtp", "api".
	Type string `json:"type,required"`
	// When the credential was last updated
	UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
	// The credential key (secret). Only included when:
	//
	// - Creating a new credential (always returned)
	// - Retrieving with `reveal=true`
	Key string `json:"key"`
	// SMTP username for authentication. Only included for SMTP credentials when the
	// key is revealed.
	SmtpUsername string `json:"smtpUsername"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		CreatedAt    respjson.Field
		Hold         respjson.Field
		LastUsedAt   respjson.Field
		Name         respjson.Field
		Type         respjson.Field
		UpdatedAt    respjson.Field
		Key          respjson.Field
		SmtpUsername respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantCredentialGetResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantCredentialGetResponseData) UnmarshalJSON added in v0.18.0

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

type TenantCredentialListParams added in v0.18.0

type TenantCredentialListParams struct {
	// Page number (1-indexed)
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Number of items per page (max 100)
	PerPage param.Opt[int64] `query:"perPage,omitzero" json:"-"`
	// Filter by credential type
	//
	// Any of "smtp", "api".
	Type TenantCredentialListParamsType `query:"type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TenantCredentialListParams) URLQuery added in v0.18.0

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

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

type TenantCredentialListParamsType added in v0.18.0

type TenantCredentialListParamsType string

Filter by credential type

const (
	TenantCredentialListParamsTypeSmtp TenantCredentialListParamsType = "smtp"
	TenantCredentialListParamsTypeAPI  TenantCredentialListParamsType = "api"
)

type TenantCredentialListResponse added in v0.18.0

type TenantCredentialListResponse struct {
	// Unique identifier for the credential
	ID int64 `json:"id,required"`
	// When the credential was created
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// Whether the credential is on hold (disabled). When `true`, the credential cannot
	// be used to send emails.
	Hold bool `json:"hold,required"`
	// When the credential was last used to send an email
	LastUsedAt time.Time `json:"lastUsedAt,required" format:"date-time"`
	// Name of the credential
	Name string `json:"name,required"`
	// Type of credential:
	//
	// - `smtp` - For SMTP-based email sending
	// - `api` - For API-based email sending
	//
	// Any of "smtp", "api".
	Type TenantCredentialListResponseType `json:"type,required"`
	// When the credential was last updated
	UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Hold        respjson.Field
		LastUsedAt  respjson.Field
		Name        respjson.Field
		Type        respjson.Field
		UpdatedAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantCredentialListResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantCredentialListResponse) UnmarshalJSON added in v0.18.0

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

type TenantCredentialListResponseType added in v0.18.0

type TenantCredentialListResponseType string

Type of credential:

- `smtp` - For SMTP-based email sending - `api` - For API-based email sending

const (
	TenantCredentialListResponseTypeSmtp TenantCredentialListResponseType = "smtp"
	TenantCredentialListResponseTypeAPI  TenantCredentialListResponseType = "api"
)

type TenantCredentialNewParams added in v0.18.0

type TenantCredentialNewParams struct {
	// Name for the credential. Can only contain letters, numbers, hyphens, and
	// underscores. Max 50 characters.
	Name string `json:"name,required"`
	// Type of credential:
	//
	// - `smtp` - For SMTP-based email sending
	// - `api` - For API-based email sending
	//
	// Any of "smtp", "api".
	Type TenantCredentialNewParamsType `json:"type,omitzero,required"`
	// contains filtered or unexported fields
}

func (TenantCredentialNewParams) MarshalJSON added in v0.18.0

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

func (*TenantCredentialNewParams) UnmarshalJSON added in v0.18.0

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

type TenantCredentialNewParamsType added in v0.18.0

type TenantCredentialNewParamsType string

Type of credential:

- `smtp` - For SMTP-based email sending - `api` - For API-based email sending

const (
	TenantCredentialNewParamsTypeSmtp TenantCredentialNewParamsType = "smtp"
	TenantCredentialNewParamsTypeAPI  TenantCredentialNewParamsType = "api"
)

type TenantCredentialNewResponse added in v0.18.0

type TenantCredentialNewResponse struct {
	Data    TenantCredentialNewResponseData `json:"data,required"`
	Meta    shared.APIMeta                  `json:"meta,required"`
	Success bool                            `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantCredentialNewResponse) RawJSON added in v0.18.0

func (r TenantCredentialNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantCredentialNewResponse) UnmarshalJSON added in v0.18.0

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

type TenantCredentialNewResponseData added in v0.18.0

type TenantCredentialNewResponseData struct {
	// Unique identifier for the credential
	ID int64 `json:"id,required"`
	// When the credential was created
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// Whether the credential is on hold (disabled). When `true`, the credential cannot
	// be used to send emails.
	Hold bool `json:"hold,required"`
	// The credential key (secret). **Store this securely** - it will not be shown
	// again unless you use the reveal parameter.
	Key string `json:"key,required"`
	// When the credential was last used to send an email
	LastUsedAt time.Time `json:"lastUsedAt,required" format:"date-time"`
	// Name of the credential
	Name string `json:"name,required"`
	// Type of credential:
	//
	// - `smtp` - For SMTP-based email sending
	// - `api` - For API-based email sending
	//
	// Any of "smtp", "api".
	Type string `json:"type,required"`
	// When the credential was last updated
	UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
	// SMTP username for authentication. Only included for SMTP credentials. Format:
	// `{tenantId}/{key}`
	SmtpUsername string `json:"smtpUsername"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		CreatedAt    respjson.Field
		Hold         respjson.Field
		Key          respjson.Field
		LastUsedAt   respjson.Field
		Name         respjson.Field
		Type         respjson.Field
		UpdatedAt    respjson.Field
		SmtpUsername respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantCredentialNewResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantCredentialNewResponseData) UnmarshalJSON added in v0.18.0

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

type TenantCredentialService added in v0.18.0

type TenantCredentialService struct {
	Options []option.RequestOption
}

TenantCredentialService contains methods and other services that help with interacting with the ark 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 NewTenantCredentialService method instead.

func NewTenantCredentialService added in v0.18.0

func NewTenantCredentialService(opts ...option.RequestOption) (r TenantCredentialService)

NewTenantCredentialService 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 (*TenantCredentialService) Delete added in v0.18.0

Permanently delete (revoke) a credential. The credential can no longer be used to send emails.

**Warning:** This action is irreversible. If you want to temporarily disable a credential, use the update endpoint to set `hold: true` instead.

func (*TenantCredentialService) Get added in v0.18.0

Get details of a specific credential.

**Revealing the key:** By default, the credential key is not returned. Pass `reveal=true` to include the key in the response. Use this sparingly and only when you need to retrieve the key (e.g., for configuration).

func (*TenantCredentialService) List added in v0.18.0

List all SMTP and API credentials for a tenant. Credentials are used to send emails via Ark on behalf of the tenant.

**Security:** Credential keys are not returned in the list response. Use the retrieve endpoint with `reveal=true` to get the key.

func (*TenantCredentialService) ListAutoPaging added in v0.18.0

List all SMTP and API credentials for a tenant. Credentials are used to send emails via Ark on behalf of the tenant.

**Security:** Credential keys are not returned in the list response. Use the retrieve endpoint with `reveal=true` to get the key.

func (*TenantCredentialService) New added in v0.18.0

Create a new SMTP or API credential for a tenant. The credential can be used to send emails via Ark on behalf of the tenant.

**Important:** The credential key is only returned once at creation time. Store it securely - you cannot retrieve it again.

**Credential Types:**

- `smtp` - For SMTP-based email sending. Returns both `key` and `smtpUsername`. - `api` - For API-based email sending. Returns only `key`.

func (*TenantCredentialService) Update added in v0.18.0

Update a credential's name or hold status.

**Hold Status:**

  • When `hold: true`, the credential is disabled and cannot be used to send emails.
  • When `hold: false`, the credential is active and can send emails.
  • Use this to temporarily disable a credential without deleting it.

type TenantCredentialUpdateParams added in v0.18.0

type TenantCredentialUpdateParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// Set to `true` to disable the credential (put on hold). Set to `false` to enable
	// the credential (release from hold).
	Hold param.Opt[bool] `json:"hold,omitzero"`
	// New name for the credential
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (TenantCredentialUpdateParams) MarshalJSON added in v0.18.0

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

func (*TenantCredentialUpdateParams) UnmarshalJSON added in v0.18.0

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

type TenantCredentialUpdateResponse added in v0.18.0

type TenantCredentialUpdateResponse struct {
	Data    TenantCredentialUpdateResponseData `json:"data,required"`
	Meta    shared.APIMeta                     `json:"meta,required"`
	Success bool                               `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantCredentialUpdateResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantCredentialUpdateResponse) UnmarshalJSON added in v0.18.0

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

type TenantCredentialUpdateResponseData added in v0.18.0

type TenantCredentialUpdateResponseData struct {
	// Unique identifier for the credential
	ID int64 `json:"id,required"`
	// When the credential was created
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// Whether the credential is on hold (disabled). When `true`, the credential cannot
	// be used to send emails.
	Hold bool `json:"hold,required"`
	// When the credential was last used to send an email
	LastUsedAt time.Time `json:"lastUsedAt,required" format:"date-time"`
	// Name of the credential
	Name string `json:"name,required"`
	// Type of credential:
	//
	// - `smtp` - For SMTP-based email sending
	// - `api` - For API-based email sending
	//
	// Any of "smtp", "api".
	Type string `json:"type,required"`
	// When the credential was last updated
	UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
	// The credential key (secret). Only included when:
	//
	// - Creating a new credential (always returned)
	// - Retrieving with `reveal=true`
	Key string `json:"key"`
	// SMTP username for authentication. Only included for SMTP credentials when the
	// key is revealed.
	SmtpUsername string `json:"smtpUsername"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		CreatedAt    respjson.Field
		Hold         respjson.Field
		LastUsedAt   respjson.Field
		Name         respjson.Field
		Type         respjson.Field
		UpdatedAt    respjson.Field
		Key          respjson.Field
		SmtpUsername respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantCredentialUpdateResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantCredentialUpdateResponseData) UnmarshalJSON added in v0.18.0

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

type TenantDeleteResponse added in v0.17.0

type TenantDeleteResponse struct {
	Data    TenantDeleteResponseData `json:"data,required"`
	Meta    shared.APIMeta           `json:"meta,required"`
	Success bool                     `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantDeleteResponse) RawJSON added in v0.17.0

func (r TenantDeleteResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantDeleteResponse) UnmarshalJSON added in v0.17.0

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

type TenantDeleteResponseData added in v0.17.0

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

func (TenantDeleteResponseData) RawJSON added in v0.17.0

func (r TenantDeleteResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantDeleteResponseData) UnmarshalJSON added in v0.17.0

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

type TenantDomainDeleteParams added in v0.18.0

type TenantDomainDeleteParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// contains filtered or unexported fields
}

type TenantDomainDeleteResponse added in v0.18.0

type TenantDomainDeleteResponse struct {
	Data    TenantDomainDeleteResponseData `json:"data,required"`
	Meta    shared.APIMeta                 `json:"meta,required"`
	Success bool                           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantDomainDeleteResponse) RawJSON added in v0.18.0

func (r TenantDomainDeleteResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantDomainDeleteResponse) UnmarshalJSON added in v0.18.0

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

type TenantDomainDeleteResponseData added in v0.18.0

type TenantDomainDeleteResponseData struct {
	Message string `json:"message,required"`
	// 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 (TenantDomainDeleteResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantDomainDeleteResponseData) UnmarshalJSON added in v0.18.0

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

type TenantDomainGetParams added in v0.18.0

type TenantDomainGetParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// contains filtered or unexported fields
}

type TenantDomainGetResponse added in v0.18.0

type TenantDomainGetResponse struct {
	Data    TenantDomainGetResponseData `json:"data,required"`
	Meta    shared.APIMeta              `json:"meta,required"`
	Success bool                        `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantDomainGetResponse) RawJSON added in v0.18.0

func (r TenantDomainGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantDomainGetResponse) UnmarshalJSON added in v0.18.0

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

type TenantDomainGetResponseData added in v0.18.0

type TenantDomainGetResponseData struct {
	// Unique domain identifier
	ID int64 `json:"id,required"`
	// Timestamp when the domain was added
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// DNS records that must be added to your domain's DNS settings. Null if records
	// are not yet generated.
	//
	// **Important:** The `name` field contains the relative hostname that you should
	// enter in your DNS provider. Most DNS providers auto-append the zone name, so you
	// only need to enter the relative part.
	//
	// For subdomains like `mail.example.com`, the zone is `example.com`, so:
	//
	// - SPF `name` would be `mail` (not `@`)
	// - DKIM `name` would be `ark-xyz._domainkey.mail`
	// - Return Path `name` would be `psrp.mail`
	DNSRecords TenantDomainGetResponseDataDNSRecords `json:"dnsRecords,required"`
	// The domain name used for sending emails
	Name string `json:"name,required"`
	// UUID of the domain
	Uuid string `json:"uuid,required" format:"uuid"`
	// Whether all DNS records (SPF, DKIM, Return Path) are correctly configured.
	// Domain must be verified before sending emails.
	Verified bool `json:"verified,required"`
	// ID of the tenant this domain belongs to
	TenantID string `json:"tenant_id"`
	// Name of the tenant this domain belongs to
	TenantName string `json:"tenant_name"`
	// Timestamp when the domain ownership was verified, or null if not yet verified
	VerifiedAt time.Time `json:"verifiedAt,nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		DNSRecords  respjson.Field
		Name        respjson.Field
		Uuid        respjson.Field
		Verified    respjson.Field
		TenantID    respjson.Field
		TenantName  respjson.Field
		VerifiedAt  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantDomainGetResponseData) RawJSON added in v0.18.0

func (r TenantDomainGetResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantDomainGetResponseData) UnmarshalJSON added in v0.18.0

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

type TenantDomainGetResponseDataDNSRecords added in v0.18.0

type TenantDomainGetResponseDataDNSRecords struct {
	// A DNS record that needs to be configured in your domain's DNS settings.
	//
	// The `name` field contains the relative hostname to enter in your DNS provider
	// (which auto-appends the zone). The `fullName` field contains the complete
	// fully-qualified domain name (FQDN) for reference.
	//
	// **Example for subdomain `mail.example.com`:**
	//
	// - `name`: `"mail"` (what you enter in DNS provider)
	// - `fullName`: `"mail.example.com"` (the complete hostname)
	//
	// **Example for root domain `example.com`:**
	//
	// - `name`: `"@"` (DNS shorthand for apex/root)
	// - `fullName`: `"example.com"`
	Dkim DNSRecord `json:"dkim,nullable"`
	// A DNS record that needs to be configured in your domain's DNS settings.
	//
	// The `name` field contains the relative hostname to enter in your DNS provider
	// (which auto-appends the zone). The `fullName` field contains the complete
	// fully-qualified domain name (FQDN) for reference.
	//
	// **Example for subdomain `mail.example.com`:**
	//
	// - `name`: `"mail"` (what you enter in DNS provider)
	// - `fullName`: `"mail.example.com"` (the complete hostname)
	//
	// **Example for root domain `example.com`:**
	//
	// - `name`: `"@"` (DNS shorthand for apex/root)
	// - `fullName`: `"example.com"`
	ReturnPath DNSRecord `json:"returnPath,nullable"`
	// A DNS record that needs to be configured in your domain's DNS settings.
	//
	// The `name` field contains the relative hostname to enter in your DNS provider
	// (which auto-appends the zone). The `fullName` field contains the complete
	// fully-qualified domain name (FQDN) for reference.
	//
	// **Example for subdomain `mail.example.com`:**
	//
	// - `name`: `"mail"` (what you enter in DNS provider)
	// - `fullName`: `"mail.example.com"` (the complete hostname)
	//
	// **Example for root domain `example.com`:**
	//
	// - `name`: `"@"` (DNS shorthand for apex/root)
	// - `fullName`: `"example.com"`
	Spf DNSRecord `json:"spf,nullable"`
	// The DNS zone (registrable domain) where records should be added. This is the
	// root domain that your DNS provider manages. For `mail.example.com`, the zone is
	// `example.com`. For `example.co.uk`, the zone is `example.co.uk`.
	Zone string `json:"zone"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Dkim        respjson.Field
		ReturnPath  respjson.Field
		Spf         respjson.Field
		Zone        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

DNS records that must be added to your domain's DNS settings. Null if records are not yet generated.

**Important:** The `name` field contains the relative hostname that you should enter in your DNS provider. Most DNS providers auto-append the zone name, so you only need to enter the relative part.

For subdomains like `mail.example.com`, the zone is `example.com`, so:

- SPF `name` would be `mail` (not `@`) - DKIM `name` would be `ark-xyz._domainkey.mail` - Return Path `name` would be `psrp.mail`

func (TenantDomainGetResponseDataDNSRecords) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantDomainGetResponseDataDNSRecords) UnmarshalJSON added in v0.18.0

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

type TenantDomainListResponse added in v0.18.0

type TenantDomainListResponse struct {
	Data    TenantDomainListResponseData `json:"data,required"`
	Meta    shared.APIMeta               `json:"meta,required"`
	Success bool                         `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantDomainListResponse) RawJSON added in v0.18.0

func (r TenantDomainListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantDomainListResponse) UnmarshalJSON added in v0.18.0

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

type TenantDomainListResponseData added in v0.18.0

type TenantDomainListResponseData struct {
	Domains []TenantDomainListResponseDataDomain `json:"domains,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Domains     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantDomainListResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantDomainListResponseData) UnmarshalJSON added in v0.18.0

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

type TenantDomainListResponseDataDomain added in v0.18.0

type TenantDomainListResponseDataDomain struct {
	// Unique domain identifier
	ID int64 `json:"id,required"`
	// The domain name used for sending emails
	Name string `json:"name,required"`
	// Whether all DNS records (SPF, DKIM, Return Path) are correctly configured.
	// Domain must be verified before sending emails.
	Verified bool `json:"verified,required"`
	// ID of the tenant this domain belongs to (included when filtering by tenant_id)
	TenantID string `json:"tenant_id"`
	// Name of the tenant this domain belongs to (included when filtering by tenant_id)
	TenantName string `json:"tenant_name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		Verified    respjson.Field
		TenantID    respjson.Field
		TenantName  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantDomainListResponseDataDomain) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantDomainListResponseDataDomain) UnmarshalJSON added in v0.18.0

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

type TenantDomainNewParams added in v0.18.0

type TenantDomainNewParams struct {
	// Domain name (e.g., "mail.example.com")
	Name string `json:"name,required"`
	// contains filtered or unexported fields
}

func (TenantDomainNewParams) MarshalJSON added in v0.18.0

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

func (*TenantDomainNewParams) UnmarshalJSON added in v0.18.0

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

type TenantDomainNewResponse added in v0.18.0

type TenantDomainNewResponse struct {
	Data    TenantDomainNewResponseData `json:"data,required"`
	Meta    shared.APIMeta              `json:"meta,required"`
	Success bool                        `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantDomainNewResponse) RawJSON added in v0.18.0

func (r TenantDomainNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantDomainNewResponse) UnmarshalJSON added in v0.18.0

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

type TenantDomainNewResponseData added in v0.18.0

type TenantDomainNewResponseData struct {
	// Unique domain identifier
	ID int64 `json:"id,required"`
	// Timestamp when the domain was added
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// DNS records that must be added to your domain's DNS settings. Null if records
	// are not yet generated.
	//
	// **Important:** The `name` field contains the relative hostname that you should
	// enter in your DNS provider. Most DNS providers auto-append the zone name, so you
	// only need to enter the relative part.
	//
	// For subdomains like `mail.example.com`, the zone is `example.com`, so:
	//
	// - SPF `name` would be `mail` (not `@`)
	// - DKIM `name` would be `ark-xyz._domainkey.mail`
	// - Return Path `name` would be `psrp.mail`
	DNSRecords TenantDomainNewResponseDataDNSRecords `json:"dnsRecords,required"`
	// The domain name used for sending emails
	Name string `json:"name,required"`
	// UUID of the domain
	Uuid string `json:"uuid,required" format:"uuid"`
	// Whether all DNS records (SPF, DKIM, Return Path) are correctly configured.
	// Domain must be verified before sending emails.
	Verified bool `json:"verified,required"`
	// ID of the tenant this domain belongs to
	TenantID string `json:"tenant_id"`
	// Name of the tenant this domain belongs to
	TenantName string `json:"tenant_name"`
	// Timestamp when the domain ownership was verified, or null if not yet verified
	VerifiedAt time.Time `json:"verifiedAt,nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		DNSRecords  respjson.Field
		Name        respjson.Field
		Uuid        respjson.Field
		Verified    respjson.Field
		TenantID    respjson.Field
		TenantName  respjson.Field
		VerifiedAt  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantDomainNewResponseData) RawJSON added in v0.18.0

func (r TenantDomainNewResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantDomainNewResponseData) UnmarshalJSON added in v0.18.0

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

type TenantDomainNewResponseDataDNSRecords added in v0.18.0

type TenantDomainNewResponseDataDNSRecords struct {
	// A DNS record that needs to be configured in your domain's DNS settings.
	//
	// The `name` field contains the relative hostname to enter in your DNS provider
	// (which auto-appends the zone). The `fullName` field contains the complete
	// fully-qualified domain name (FQDN) for reference.
	//
	// **Example for subdomain `mail.example.com`:**
	//
	// - `name`: `"mail"` (what you enter in DNS provider)
	// - `fullName`: `"mail.example.com"` (the complete hostname)
	//
	// **Example for root domain `example.com`:**
	//
	// - `name`: `"@"` (DNS shorthand for apex/root)
	// - `fullName`: `"example.com"`
	Dkim DNSRecord `json:"dkim,nullable"`
	// A DNS record that needs to be configured in your domain's DNS settings.
	//
	// The `name` field contains the relative hostname to enter in your DNS provider
	// (which auto-appends the zone). The `fullName` field contains the complete
	// fully-qualified domain name (FQDN) for reference.
	//
	// **Example for subdomain `mail.example.com`:**
	//
	// - `name`: `"mail"` (what you enter in DNS provider)
	// - `fullName`: `"mail.example.com"` (the complete hostname)
	//
	// **Example for root domain `example.com`:**
	//
	// - `name`: `"@"` (DNS shorthand for apex/root)
	// - `fullName`: `"example.com"`
	ReturnPath DNSRecord `json:"returnPath,nullable"`
	// A DNS record that needs to be configured in your domain's DNS settings.
	//
	// The `name` field contains the relative hostname to enter in your DNS provider
	// (which auto-appends the zone). The `fullName` field contains the complete
	// fully-qualified domain name (FQDN) for reference.
	//
	// **Example for subdomain `mail.example.com`:**
	//
	// - `name`: `"mail"` (what you enter in DNS provider)
	// - `fullName`: `"mail.example.com"` (the complete hostname)
	//
	// **Example for root domain `example.com`:**
	//
	// - `name`: `"@"` (DNS shorthand for apex/root)
	// - `fullName`: `"example.com"`
	Spf DNSRecord `json:"spf,nullable"`
	// The DNS zone (registrable domain) where records should be added. This is the
	// root domain that your DNS provider manages. For `mail.example.com`, the zone is
	// `example.com`. For `example.co.uk`, the zone is `example.co.uk`.
	Zone string `json:"zone"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Dkim        respjson.Field
		ReturnPath  respjson.Field
		Spf         respjson.Field
		Zone        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

DNS records that must be added to your domain's DNS settings. Null if records are not yet generated.

**Important:** The `name` field contains the relative hostname that you should enter in your DNS provider. Most DNS providers auto-append the zone name, so you only need to enter the relative part.

For subdomains like `mail.example.com`, the zone is `example.com`, so:

- SPF `name` would be `mail` (not `@`) - DKIM `name` would be `ark-xyz._domainkey.mail` - Return Path `name` would be `psrp.mail`

func (TenantDomainNewResponseDataDNSRecords) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantDomainNewResponseDataDNSRecords) UnmarshalJSON added in v0.18.0

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

type TenantDomainService added in v0.18.0

type TenantDomainService struct {
	Options []option.RequestOption
}

TenantDomainService contains methods and other services that help with interacting with the ark 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 NewTenantDomainService method instead.

func NewTenantDomainService added in v0.18.0

func NewTenantDomainService(opts ...option.RequestOption) (r TenantDomainService)

NewTenantDomainService 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 (*TenantDomainService) Delete added in v0.18.0

Remove a sending domain from a tenant. You will no longer be able to send emails from this domain.

**Warning:** This action cannot be undone.

func (*TenantDomainService) Get added in v0.18.0

Get detailed information about a domain including DNS record status.

func (*TenantDomainService) List added in v0.18.0

func (r *TenantDomainService) List(ctx context.Context, tenantID string, opts ...option.RequestOption) (res *TenantDomainListResponse, err error)

Get all sending domains for a specific tenant with their verification status.

func (*TenantDomainService) New added in v0.18.0

Add a new sending domain to a tenant. Returns DNS records that must be configured before the domain can be verified.

Each tenant gets their own isolated mail server for domain isolation.

**Required DNS records:**

- **SPF** - TXT record for sender authentication - **DKIM** - TXT record for email signing - **Return Path** - CNAME for bounce handling

After adding DNS records, call `POST /tenants/{tenantId}/domains/{domainId}/verify` to verify.

func (*TenantDomainService) Verify added in v0.18.0

Check if DNS records are correctly configured and verify the domain. Returns the current status of each required DNS record.

Call this after you've added the DNS records shown when creating the domain.

type TenantDomainVerifyParams added in v0.18.0

type TenantDomainVerifyParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// contains filtered or unexported fields
}

type TenantDomainVerifyResponse added in v0.18.0

type TenantDomainVerifyResponse struct {
	Data    TenantDomainVerifyResponseData `json:"data,required"`
	Meta    shared.APIMeta                 `json:"meta,required"`
	Success bool                           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantDomainVerifyResponse) RawJSON added in v0.18.0

func (r TenantDomainVerifyResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantDomainVerifyResponse) UnmarshalJSON added in v0.18.0

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

type TenantDomainVerifyResponseData added in v0.18.0

type TenantDomainVerifyResponseData struct {
	// Unique domain identifier
	ID int64 `json:"id,required"`
	// Timestamp when the domain was added
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// DNS records that must be added to your domain's DNS settings. Null if records
	// are not yet generated.
	//
	// **Important:** The `name` field contains the relative hostname that you should
	// enter in your DNS provider. Most DNS providers auto-append the zone name, so you
	// only need to enter the relative part.
	//
	// For subdomains like `mail.example.com`, the zone is `example.com`, so:
	//
	// - SPF `name` would be `mail` (not `@`)
	// - DKIM `name` would be `ark-xyz._domainkey.mail`
	// - Return Path `name` would be `psrp.mail`
	DNSRecords TenantDomainVerifyResponseDataDNSRecords `json:"dnsRecords,required"`
	// The domain name used for sending emails
	Name string `json:"name,required"`
	// UUID of the domain
	Uuid string `json:"uuid,required" format:"uuid"`
	// Whether all DNS records (SPF, DKIM, Return Path) are correctly configured.
	// Domain must be verified before sending emails.
	Verified bool `json:"verified,required"`
	// ID of the tenant this domain belongs to
	TenantID string `json:"tenant_id"`
	// Name of the tenant this domain belongs to
	TenantName string `json:"tenant_name"`
	// Timestamp when the domain ownership was verified, or null if not yet verified
	VerifiedAt time.Time `json:"verifiedAt,nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		DNSRecords  respjson.Field
		Name        respjson.Field
		Uuid        respjson.Field
		Verified    respjson.Field
		TenantID    respjson.Field
		TenantName  respjson.Field
		VerifiedAt  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantDomainVerifyResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantDomainVerifyResponseData) UnmarshalJSON added in v0.18.0

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

type TenantDomainVerifyResponseDataDNSRecords added in v0.18.0

type TenantDomainVerifyResponseDataDNSRecords struct {
	// A DNS record that needs to be configured in your domain's DNS settings.
	//
	// The `name` field contains the relative hostname to enter in your DNS provider
	// (which auto-appends the zone). The `fullName` field contains the complete
	// fully-qualified domain name (FQDN) for reference.
	//
	// **Example for subdomain `mail.example.com`:**
	//
	// - `name`: `"mail"` (what you enter in DNS provider)
	// - `fullName`: `"mail.example.com"` (the complete hostname)
	//
	// **Example for root domain `example.com`:**
	//
	// - `name`: `"@"` (DNS shorthand for apex/root)
	// - `fullName`: `"example.com"`
	Dkim DNSRecord `json:"dkim,nullable"`
	// A DNS record that needs to be configured in your domain's DNS settings.
	//
	// The `name` field contains the relative hostname to enter in your DNS provider
	// (which auto-appends the zone). The `fullName` field contains the complete
	// fully-qualified domain name (FQDN) for reference.
	//
	// **Example for subdomain `mail.example.com`:**
	//
	// - `name`: `"mail"` (what you enter in DNS provider)
	// - `fullName`: `"mail.example.com"` (the complete hostname)
	//
	// **Example for root domain `example.com`:**
	//
	// - `name`: `"@"` (DNS shorthand for apex/root)
	// - `fullName`: `"example.com"`
	ReturnPath DNSRecord `json:"returnPath,nullable"`
	// A DNS record that needs to be configured in your domain's DNS settings.
	//
	// The `name` field contains the relative hostname to enter in your DNS provider
	// (which auto-appends the zone). The `fullName` field contains the complete
	// fully-qualified domain name (FQDN) for reference.
	//
	// **Example for subdomain `mail.example.com`:**
	//
	// - `name`: `"mail"` (what you enter in DNS provider)
	// - `fullName`: `"mail.example.com"` (the complete hostname)
	//
	// **Example for root domain `example.com`:**
	//
	// - `name`: `"@"` (DNS shorthand for apex/root)
	// - `fullName`: `"example.com"`
	Spf DNSRecord `json:"spf,nullable"`
	// The DNS zone (registrable domain) where records should be added. This is the
	// root domain that your DNS provider manages. For `mail.example.com`, the zone is
	// `example.com`. For `example.co.uk`, the zone is `example.co.uk`.
	Zone string `json:"zone"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Dkim        respjson.Field
		ReturnPath  respjson.Field
		Spf         respjson.Field
		Zone        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

DNS records that must be added to your domain's DNS settings. Null if records are not yet generated.

**Important:** The `name` field contains the relative hostname that you should enter in your DNS provider. Most DNS providers auto-append the zone name, so you only need to enter the relative part.

For subdomains like `mail.example.com`, the zone is `example.com`, so:

- SPF `name` would be `mail` (not `@`) - DKIM `name` would be `ark-xyz._domainkey.mail` - Return Path `name` would be `psrp.mail`

func (TenantDomainVerifyResponseDataDNSRecords) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantDomainVerifyResponseDataDNSRecords) UnmarshalJSON added in v0.18.0

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

type TenantGetResponse added in v0.17.0

type TenantGetResponse struct {
	Data    Tenant         `json:"data,required"`
	Meta    shared.APIMeta `json:"meta,required"`
	Success bool           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantGetResponse) RawJSON added in v0.17.0

func (r TenantGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantGetResponse) UnmarshalJSON added in v0.17.0

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

type TenantListParams added in v0.17.0

type TenantListParams struct {
	// Page number (1-indexed)
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Number of items per page (max 100)
	PerPage param.Opt[int64] `query:"perPage,omitzero" json:"-"`
	// Filter by tenant status
	//
	// Any of "active", "suspended", "archived".
	Status TenantListParamsStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TenantListParams) URLQuery added in v0.17.0

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

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

type TenantListParamsStatus added in v0.17.0

type TenantListParamsStatus string

Filter by tenant status

const (
	TenantListParamsStatusActive    TenantListParamsStatus = "active"
	TenantListParamsStatusSuspended TenantListParamsStatus = "suspended"
	TenantListParamsStatusArchived  TenantListParamsStatus = "archived"
)

type TenantMetadataUnion added in v0.17.0

type TenantMetadataUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	JSON   struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

TenantMetadataUnion contains all possible properties and values from [string], [float64], [bool].

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

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]

func (TenantMetadataUnion) AsBool added in v0.17.0

func (u TenantMetadataUnion) AsBool() (v bool)

func (TenantMetadataUnion) AsFloat added in v0.17.0

func (u TenantMetadataUnion) AsFloat() (v float64)

func (TenantMetadataUnion) AsString added in v0.17.0

func (u TenantMetadataUnion) AsString() (v string)

func (TenantMetadataUnion) RawJSON added in v0.17.0

func (u TenantMetadataUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantMetadataUnion) UnmarshalJSON added in v0.17.0

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

type TenantNewParams added in v0.17.0

type TenantNewParams struct {
	// Display name for the tenant (e.g., your customer's company name)
	Name string `json:"name,required"`
	// Custom key-value pairs. Useful for storing references to your internal systems.
	//
	// **Limits:**
	//
	// - Max 50 keys
	// - Key names max 40 characters
	// - String values max 500 characters
	// - Total size max 8KB
	Metadata map[string]TenantNewParamsMetadataUnion `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

func (TenantNewParams) MarshalJSON added in v0.17.0

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

func (*TenantNewParams) UnmarshalJSON added in v0.17.0

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

type TenantNewParamsMetadataUnion added in v0.17.0

type TenantNewParamsMetadataUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `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 (TenantNewParamsMetadataUnion) MarshalJSON added in v0.17.0

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

func (*TenantNewParamsMetadataUnion) UnmarshalJSON added in v0.17.0

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

type TenantNewResponse added in v0.17.0

type TenantNewResponse struct {
	Data    Tenant         `json:"data,required"`
	Meta    shared.APIMeta `json:"meta,required"`
	Success bool           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantNewResponse) RawJSON added in v0.17.0

func (r TenantNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantNewResponse) UnmarshalJSON added in v0.17.0

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

type TenantService added in v0.17.0

type TenantService struct {
	Options      []option.RequestOption
	Credentials  TenantCredentialService
	Domains      TenantDomainService
	Suppressions TenantSuppressionService
	Webhooks     TenantWebhookService
	Tracking     TenantTrackingService
	Usage        TenantUsageService
}

TenantService contains methods and other services that help with interacting with the ark 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 NewTenantService method instead.

func NewTenantService added in v0.17.0

func NewTenantService(opts ...option.RequestOption) (r TenantService)

NewTenantService 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 (*TenantService) Delete added in v0.17.0

func (r *TenantService) Delete(ctx context.Context, tenantID string, opts ...option.RequestOption) (res *TenantDeleteResponse, err error)

Permanently delete a tenant. This cannot be undone.

func (*TenantService) Get added in v0.17.0

func (r *TenantService) Get(ctx context.Context, tenantID string, opts ...option.RequestOption) (res *TenantGetResponse, err error)

Get a tenant by ID.

func (*TenantService) List added in v0.17.0

List all tenants with pagination. Filter by `status` if needed.

func (*TenantService) ListAutoPaging added in v0.17.0

List all tenants with pagination. Filter by `status` if needed.

func (*TenantService) New added in v0.17.0

Create a new tenant.

Returns the created tenant with a unique `id`. Store this ID in your database to reference this tenant later.

func (*TenantService) Update added in v0.17.0

func (r *TenantService) Update(ctx context.Context, tenantID string, body TenantUpdateParams, opts ...option.RequestOption) (res *TenantUpdateResponse, err error)

Update a tenant's name, metadata, or status. At least one field is required.

Metadata is replaced entirely—include all keys you want to keep.

type TenantStatus added in v0.17.0

type TenantStatus string

Current status of the tenant:

- `active` - Normal operation - `suspended` - Temporarily disabled - `archived` - Soft-deleted

const (
	TenantStatusActive    TenantStatus = "active"
	TenantStatusSuspended TenantStatus = "suspended"
	TenantStatusArchived  TenantStatus = "archived"
)

type TenantSuppressionDeleteParams added in v0.18.0

type TenantSuppressionDeleteParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// contains filtered or unexported fields
}

type TenantSuppressionDeleteResponse added in v0.18.0

type TenantSuppressionDeleteResponse struct {
	Data    TenantSuppressionDeleteResponseData `json:"data,required"`
	Meta    shared.APIMeta                      `json:"meta,required"`
	Success bool                                `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantSuppressionDeleteResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantSuppressionDeleteResponse) UnmarshalJSON added in v0.18.0

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

type TenantSuppressionDeleteResponseData added in v0.18.0

type TenantSuppressionDeleteResponseData struct {
	Message string `json:"message,required"`
	// 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 (TenantSuppressionDeleteResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantSuppressionDeleteResponseData) UnmarshalJSON added in v0.18.0

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

type TenantSuppressionGetParams added in v0.18.0

type TenantSuppressionGetParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// contains filtered or unexported fields
}

type TenantSuppressionGetResponse added in v0.18.0

type TenantSuppressionGetResponse struct {
	Data    TenantSuppressionGetResponseData `json:"data,required"`
	Meta    shared.APIMeta                   `json:"meta,required"`
	Success bool                             `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantSuppressionGetResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantSuppressionGetResponse) UnmarshalJSON added in v0.18.0

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

type TenantSuppressionGetResponseData added in v0.18.0

type TenantSuppressionGetResponseData struct {
	// The email address that was checked
	Address string `json:"address,required" format:"email"`
	// Whether the address is currently suppressed
	Suppressed bool `json:"suppressed,required"`
	// When the suppression was created (if suppressed)
	CreatedAt time.Time `json:"createdAt,nullable" format:"date-time"`
	// Reason for suppression (if suppressed)
	Reason string `json:"reason,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Address     respjson.Field
		Suppressed  respjson.Field
		CreatedAt   respjson.Field
		Reason      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantSuppressionGetResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantSuppressionGetResponseData) UnmarshalJSON added in v0.18.0

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

type TenantSuppressionListParams added in v0.18.0

type TenantSuppressionListParams struct {
	Page    param.Opt[int64] `query:"page,omitzero" json:"-"`
	PerPage param.Opt[int64] `query:"perPage,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TenantSuppressionListParams) URLQuery added in v0.18.0

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

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

type TenantSuppressionListResponse added in v0.18.0

type TenantSuppressionListResponse struct {
	// Suppression ID
	ID        string    `json:"id,required"`
	Address   string    `json:"address,required" format:"email"`
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	Reason    string    `json:"reason"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Address     respjson.Field
		CreatedAt   respjson.Field
		Reason      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantSuppressionListResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantSuppressionListResponse) UnmarshalJSON added in v0.18.0

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

type TenantSuppressionNewParams added in v0.18.0

type TenantSuppressionNewParams struct {
	// Email address to suppress
	Address string `json:"address,required" format:"email"`
	// Reason for suppression (accepts null)
	Reason param.Opt[string] `json:"reason,omitzero"`
	// contains filtered or unexported fields
}

func (TenantSuppressionNewParams) MarshalJSON added in v0.18.0

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

func (*TenantSuppressionNewParams) UnmarshalJSON added in v0.18.0

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

type TenantSuppressionNewResponse added in v0.18.0

type TenantSuppressionNewResponse struct {
	Data    TenantSuppressionNewResponseData `json:"data,required"`
	Meta    shared.APIMeta                   `json:"meta,required"`
	Success bool                             `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantSuppressionNewResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantSuppressionNewResponse) UnmarshalJSON added in v0.18.0

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

type TenantSuppressionNewResponseData added in v0.18.0

type TenantSuppressionNewResponseData struct {
	// Suppression ID
	ID        string    `json:"id,required"`
	Address   string    `json:"address,required" format:"email"`
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// Reason for suppression
	Reason string `json:"reason"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Address     respjson.Field
		CreatedAt   respjson.Field
		Reason      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantSuppressionNewResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantSuppressionNewResponseData) UnmarshalJSON added in v0.18.0

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

type TenantSuppressionService added in v0.18.0

type TenantSuppressionService struct {
	Options []option.RequestOption
}

TenantSuppressionService contains methods and other services that help with interacting with the ark 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 NewTenantSuppressionService method instead.

func NewTenantSuppressionService added in v0.18.0

func NewTenantSuppressionService(opts ...option.RequestOption) (r TenantSuppressionService)

NewTenantSuppressionService 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 (*TenantSuppressionService) Delete added in v0.18.0

Remove an email address from the tenant's suppression list. The address will be able to receive emails from this tenant again.

func (*TenantSuppressionService) Get added in v0.18.0

Check if a specific email address is on the tenant's suppression list.

func (*TenantSuppressionService) List added in v0.18.0

Get all email addresses on the tenant's suppression list. These addresses will not receive any emails from this tenant.

func (*TenantSuppressionService) ListAutoPaging added in v0.18.0

Get all email addresses on the tenant's suppression list. These addresses will not receive any emails from this tenant.

func (*TenantSuppressionService) New added in v0.18.0

Add an email address to the tenant's suppression list. The address will not receive any emails from this tenant until removed.

type TenantTrackingDeleteParams added in v0.18.0

type TenantTrackingDeleteParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// contains filtered or unexported fields
}

type TenantTrackingDeleteResponse added in v0.18.0

type TenantTrackingDeleteResponse struct {
	Data    TenantTrackingDeleteResponseData `json:"data,required"`
	Meta    shared.APIMeta                   `json:"meta,required"`
	Success bool                             `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantTrackingDeleteResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantTrackingDeleteResponse) UnmarshalJSON added in v0.18.0

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

type TenantTrackingDeleteResponseData added in v0.18.0

type TenantTrackingDeleteResponseData struct {
	Message string `json:"message,required"`
	// 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 (TenantTrackingDeleteResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantTrackingDeleteResponseData) UnmarshalJSON added in v0.18.0

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

type TenantTrackingGetParams added in v0.18.0

type TenantTrackingGetParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// contains filtered or unexported fields
}

type TenantTrackingGetResponse added in v0.18.0

type TenantTrackingGetResponse struct {
	Data    TrackDomain    `json:"data,required"`
	Meta    shared.APIMeta `json:"meta,required"`
	Success bool           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantTrackingGetResponse) RawJSON added in v0.18.0

func (r TenantTrackingGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantTrackingGetResponse) UnmarshalJSON added in v0.18.0

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

type TenantTrackingListResponse added in v0.18.0

type TenantTrackingListResponse struct {
	Data    TenantTrackingListResponseData `json:"data,required"`
	Meta    shared.APIMeta                 `json:"meta,required"`
	Success bool                           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantTrackingListResponse) RawJSON added in v0.18.0

func (r TenantTrackingListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantTrackingListResponse) UnmarshalJSON added in v0.18.0

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

type TenantTrackingListResponseData added in v0.18.0

type TenantTrackingListResponseData struct {
	TrackDomains []TrackDomain `json:"trackDomains,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		TrackDomains respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantTrackingListResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantTrackingListResponseData) UnmarshalJSON added in v0.18.0

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

type TenantTrackingNewParams added in v0.18.0

type TenantTrackingNewParams struct {
	// ID of the sending domain to attach this track domain to
	DomainID int64 `json:"domainId,required"`
	// Subdomain name (e.g., 'track' for track.yourdomain.com)
	Name string `json:"name,required"`
	// Enable SSL for tracking URLs (accepts null, defaults to true)
	SslEnabled param.Opt[bool] `json:"sslEnabled,omitzero"`
	// Enable click tracking (accepts null, defaults to true)
	TrackClicks param.Opt[bool] `json:"trackClicks,omitzero"`
	// Enable open tracking (tracking pixel, accepts null, defaults to true)
	TrackOpens param.Opt[bool] `json:"trackOpens,omitzero"`
	// contains filtered or unexported fields
}

func (TenantTrackingNewParams) MarshalJSON added in v0.18.0

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

func (*TenantTrackingNewParams) UnmarshalJSON added in v0.18.0

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

type TenantTrackingNewResponse added in v0.18.0

type TenantTrackingNewResponse struct {
	Data    TrackDomain    `json:"data,required"`
	Meta    shared.APIMeta `json:"meta,required"`
	Success bool           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantTrackingNewResponse) RawJSON added in v0.18.0

func (r TenantTrackingNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantTrackingNewResponse) UnmarshalJSON added in v0.18.0

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

type TenantTrackingService added in v0.18.0

type TenantTrackingService struct {
	Options []option.RequestOption
}

TenantTrackingService contains methods and other services that help with interacting with the ark 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 NewTenantTrackingService method instead.

func NewTenantTrackingService added in v0.18.0

func NewTenantTrackingService(opts ...option.RequestOption) (r TenantTrackingService)

NewTenantTrackingService 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 (*TenantTrackingService) Delete added in v0.18.0

Delete a track domain. This will disable tracking for any emails using this domain.

func (*TenantTrackingService) Get added in v0.18.0

Get details of a specific track domain including DNS configuration.

func (*TenantTrackingService) List added in v0.18.0

List all track domains configured for a tenant. Track domains enable open and click tracking for emails.

func (*TenantTrackingService) New added in v0.18.0

Create a new track domain for open/click tracking for a tenant.

After creation, you must configure a CNAME record pointing to the provided DNS value before tracking will work.

func (*TenantTrackingService) Update added in v0.18.0

Update track domain settings.

Use this to:

- Enable/disable click tracking - Enable/disable open tracking - Enable/disable SSL - Set excluded click domains

func (*TenantTrackingService) Verify added in v0.18.0

Check DNS configuration for the track domain.

The track domain requires a CNAME record to be configured before open and click tracking will work. Use this endpoint to verify the DNS is correctly set up.

type TenantTrackingUpdateParams added in v0.18.0

type TenantTrackingUpdateParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// Comma-separated list of domains to exclude from click tracking (accepts null)
	ExcludedClickDomains param.Opt[string] `json:"excludedClickDomains,omitzero"`
	// Enable or disable SSL for tracking URLs (accepts null)
	SslEnabled param.Opt[bool] `json:"sslEnabled,omitzero"`
	// Enable or disable click tracking (accepts null)
	TrackClicks param.Opt[bool] `json:"trackClicks,omitzero"`
	// Enable or disable open tracking (accepts null)
	TrackOpens param.Opt[bool] `json:"trackOpens,omitzero"`
	// contains filtered or unexported fields
}

func (TenantTrackingUpdateParams) MarshalJSON added in v0.18.0

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

func (*TenantTrackingUpdateParams) UnmarshalJSON added in v0.18.0

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

type TenantTrackingUpdateResponse added in v0.18.0

type TenantTrackingUpdateResponse struct {
	Data    TrackDomain    `json:"data,required"`
	Meta    shared.APIMeta `json:"meta,required"`
	Success bool           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantTrackingUpdateResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantTrackingUpdateResponse) UnmarshalJSON added in v0.18.0

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

type TenantTrackingVerifyParams added in v0.18.0

type TenantTrackingVerifyParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// contains filtered or unexported fields
}

type TenantTrackingVerifyResponse added in v0.18.0

type TenantTrackingVerifyResponse struct {
	Data    TenantTrackingVerifyResponseData `json:"data,required"`
	Meta    shared.APIMeta                   `json:"meta,required"`
	Success bool                             `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantTrackingVerifyResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantTrackingVerifyResponse) UnmarshalJSON added in v0.18.0

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

type TenantTrackingVerifyResponseData added in v0.18.0

type TenantTrackingVerifyResponseData struct {
	// Track domain ID
	ID string `json:"id,required"`
	// Whether DNS is correctly configured
	DNSOk bool `json:"dnsOk,required"`
	// Current DNS verification status
	//
	// Any of "ok", "missing", "invalid".
	DNSStatus string `json:"dnsStatus,required"`
	// Full domain name
	FullName string `json:"fullName,required"`
	// When DNS was last checked
	DNSCheckedAt time.Time `json:"dnsCheckedAt,nullable" format:"date-time"`
	// DNS error message if verification failed
	DNSError string `json:"dnsError,nullable"`
	// Required DNS record configuration
	DNSRecord TenantTrackingVerifyResponseDataDNSRecord `json:"dnsRecord,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		DNSOk        respjson.Field
		DNSStatus    respjson.Field
		FullName     respjson.Field
		DNSCheckedAt respjson.Field
		DNSError     respjson.Field
		DNSRecord    respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantTrackingVerifyResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantTrackingVerifyResponseData) UnmarshalJSON added in v0.18.0

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

type TenantTrackingVerifyResponseDataDNSRecord added in v0.18.0

type TenantTrackingVerifyResponseDataDNSRecord struct {
	Name  string `json:"name"`
	Type  string `json:"type"`
	Value string `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name        respjson.Field
		Type        respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Required DNS record configuration

func (TenantTrackingVerifyResponseDataDNSRecord) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantTrackingVerifyResponseDataDNSRecord) UnmarshalJSON added in v0.18.0

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

type TenantUpdateParams added in v0.17.0

type TenantUpdateParams struct {
	// Display name for the tenant
	Name param.Opt[string] `json:"name,omitzero"`
	// Custom key-value pairs. Useful for storing references to your internal systems.
	//
	// **Limits:**
	//
	// - Max 50 keys
	// - Key names max 40 characters
	// - String values max 500 characters
	// - Total size max 8KB
	Metadata map[string]TenantUpdateParamsMetadataUnion `json:"metadata,omitzero"`
	// Tenant status
	//
	// Any of "active", "suspended", "archived".
	Status TenantUpdateParamsStatus `json:"status,omitzero"`
	// contains filtered or unexported fields
}

func (TenantUpdateParams) MarshalJSON added in v0.17.0

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

func (*TenantUpdateParams) UnmarshalJSON added in v0.17.0

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

type TenantUpdateParamsMetadataUnion added in v0.17.0

type TenantUpdateParamsMetadataUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `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 (TenantUpdateParamsMetadataUnion) MarshalJSON added in v0.17.0

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

func (*TenantUpdateParamsMetadataUnion) UnmarshalJSON added in v0.17.0

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

type TenantUpdateParamsStatus added in v0.17.0

type TenantUpdateParamsStatus string

Tenant status

const (
	TenantUpdateParamsStatusActive    TenantUpdateParamsStatus = "active"
	TenantUpdateParamsStatusSuspended TenantUpdateParamsStatus = "suspended"
	TenantUpdateParamsStatusArchived  TenantUpdateParamsStatus = "archived"
)

type TenantUpdateResponse added in v0.17.0

type TenantUpdateResponse struct {
	Data    Tenant         `json:"data,required"`
	Meta    shared.APIMeta `json:"meta,required"`
	Success bool           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantUpdateResponse) RawJSON added in v0.17.0

func (r TenantUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantUpdateResponse) UnmarshalJSON added in v0.17.0

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

type TenantUsage added in v0.18.0

type TenantUsage struct {
	// Email delivery counts
	Emails EmailCounts `json:"emails,required"`
	// Time period for usage data
	Period UsagePeriod `json:"period,required"`
	// Email delivery rates (as decimals, e.g., 0.95 = 95%)
	Rates EmailRates `json:"rates,required"`
	// Unique tenant identifier
	TenantID string `json:"tenant_id,required"`
	// Tenant display name
	TenantName string `json:"tenant_name,required"`
	// Your external ID for this tenant (from metadata)
	ExternalID string `json:"external_id,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Emails      respjson.Field
		Period      respjson.Field
		Rates       respjson.Field
		TenantID    respjson.Field
		TenantName  respjson.Field
		ExternalID  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Tenant usage statistics

func (TenantUsage) RawJSON added in v0.18.0

func (r TenantUsage) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantUsage) UnmarshalJSON added in v0.18.0

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

type TenantUsageGetParams added in v0.18.0

type TenantUsageGetParams struct {
	// Time period for usage data. Defaults to current month.
	//
	// **Formats:**
	//
	//   - Shortcuts: `today`, `yesterday`, `this_week`, `last_week`, `this_month`,
	//     `last_month`, `last_7_days`, `last_30_days`, `last_90_days`
	//   - Month: `2024-01`
	//   - Range: `2024-01-01..2024-01-31`
	//   - Day: `2024-01-15`
	Period param.Opt[string] `query:"period,omitzero" json:"-"`
	// Timezone for period calculations (IANA format). Defaults to UTC.
	Timezone param.Opt[string] `query:"timezone,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TenantUsageGetParams) URLQuery added in v0.18.0

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

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

type TenantUsageGetResponse added in v0.18.0

type TenantUsageGetResponse struct {
	// Tenant usage statistics
	Data    TenantUsage    `json:"data,required"`
	Meta    shared.APIMeta `json:"meta,required"`
	Success bool           `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Usage statistics for a single tenant

func (TenantUsageGetResponse) RawJSON added in v0.18.0

func (r TenantUsageGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantUsageGetResponse) UnmarshalJSON added in v0.18.0

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

type TenantUsageGetTimeseriesParams added in v0.18.0

type TenantUsageGetTimeseriesParams struct {
	// Time period for timeseries data. Defaults to current month.
	Period param.Opt[string] `query:"period,omitzero" json:"-"`
	// Timezone for period calculations (IANA format). Defaults to UTC.
	Timezone param.Opt[string] `query:"timezone,omitzero" json:"-"`
	// Time bucket size for data points
	//
	// Any of "hour", "day", "week", "month".
	Granularity TenantUsageGetTimeseriesParamsGranularity `query:"granularity,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TenantUsageGetTimeseriesParams) URLQuery added in v0.18.0

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

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

type TenantUsageGetTimeseriesParamsGranularity added in v0.18.0

type TenantUsageGetTimeseriesParamsGranularity string

Time bucket size for data points

const (
	TenantUsageGetTimeseriesParamsGranularityHour  TenantUsageGetTimeseriesParamsGranularity = "hour"
	TenantUsageGetTimeseriesParamsGranularityDay   TenantUsageGetTimeseriesParamsGranularity = "day"
	TenantUsageGetTimeseriesParamsGranularityWeek  TenantUsageGetTimeseriesParamsGranularity = "week"
	TenantUsageGetTimeseriesParamsGranularityMonth TenantUsageGetTimeseriesParamsGranularity = "month"
)

type TenantUsageGetTimeseriesResponse added in v0.18.0

type TenantUsageGetTimeseriesResponse struct {
	// Timeseries usage statistics
	Data    TenantUsageTimeseries `json:"data,required"`
	Meta    shared.APIMeta        `json:"meta,required"`
	Success bool                  `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Timeseries usage data for a tenant

func (TenantUsageGetTimeseriesResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantUsageGetTimeseriesResponse) UnmarshalJSON added in v0.18.0

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

type TenantUsageItem added in v0.18.0

type TenantUsageItem struct {
	// Email delivery counts
	Emails EmailCounts `json:"emails,required"`
	// Email delivery rates (as decimals, e.g., 0.95 = 95%)
	Rates EmailRates `json:"rates,required"`
	// Current tenant status
	//
	// Any of "active", "suspended", "archived".
	Status TenantUsageItemStatus `json:"status,required"`
	// Unique tenant identifier
	TenantID string `json:"tenantId,required"`
	// Tenant display name
	TenantName string `json:"tenantName,required"`
	// Your external ID for this tenant
	ExternalID string `json:"externalId,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Emails      respjson.Field
		Rates       respjson.Field
		Status      respjson.Field
		TenantID    respjson.Field
		TenantName  respjson.Field
		ExternalID  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Usage record for a single tenant (camelCase for SDK)

func (TenantUsageItem) RawJSON added in v0.18.0

func (r TenantUsageItem) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantUsageItem) UnmarshalJSON added in v0.18.0

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

type TenantUsageItemStatus added in v0.18.0

type TenantUsageItemStatus string

Current tenant status

const (
	TenantUsageItemStatusActive    TenantUsageItemStatus = "active"
	TenantUsageItemStatusSuspended TenantUsageItemStatus = "suspended"
	TenantUsageItemStatusArchived  TenantUsageItemStatus = "archived"
)

type TenantUsageService added in v0.18.0

type TenantUsageService struct {
	Options []option.RequestOption
}

TenantUsageService contains methods and other services that help with interacting with the ark 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 NewTenantUsageService method instead.

func NewTenantUsageService added in v0.18.0

func NewTenantUsageService(opts ...option.RequestOption) (r TenantUsageService)

NewTenantUsageService 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 (*TenantUsageService) Get added in v0.18.0

Returns email sending statistics for a specific tenant over a time period.

**Use cases:**

- Display usage dashboard to your customers - Calculate per-tenant billing - Monitor tenant health and delivery rates

**Period formats:**

  • Shortcuts: `today`, `yesterday`, `this_week`, `last_week`, `this_month`, `last_month`, `last_7_days`, `last_30_days`, `last_90_days`
  • Month: `2024-01` (full month)
  • Date range: `2024-01-01..2024-01-31`
  • Single day: `2024-01-15`

**Response includes:**

- `emails` - Counts for sent, delivered, soft_failed, hard_failed, bounced, held - `rates` - Delivery rate and bounce rate as decimals (0.95 = 95%)

func (*TenantUsageService) GetTimeseries added in v0.18.0

Returns time-bucketed email statistics for a specific tenant.

**Use cases:**

- Build usage charts and graphs - Identify sending patterns - Detect anomalies in delivery rates

**Granularity options:**

- `hour` - Hourly buckets (best for last 7 days) - `day` - Daily buckets (best for last 30-90 days) - `week` - Weekly buckets (best for last 6 months) - `month` - Monthly buckets (best for year-over-year)

The response includes a data point for each time bucket with all email metrics.

type TenantUsageTimeseries added in v0.18.0

type TenantUsageTimeseries struct {
	// Array of time-bucketed data points
	Data []TenantUsageTimeseriesData `json:"data,required"`
	// Time bucket granularity
	//
	// Any of "hour", "day", "week", "month".
	Granularity TenantUsageTimeseriesGranularity `json:"granularity,required"`
	// Time period for usage data
	Period UsagePeriod `json:"period,required"`
	// Unique tenant identifier
	TenantID string `json:"tenant_id,required"`
	// Tenant display name
	TenantName string `json:"tenant_name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Granularity respjson.Field
		Period      respjson.Field
		TenantID    respjson.Field
		TenantName  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Timeseries usage statistics

func (TenantUsageTimeseries) RawJSON added in v0.18.0

func (r TenantUsageTimeseries) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantUsageTimeseries) UnmarshalJSON added in v0.18.0

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

type TenantUsageTimeseriesData added in v0.18.0

type TenantUsageTimeseriesData struct {
	// Bounces in this bucket
	Bounced int64 `json:"bounced,required"`
	// Emails delivered in this bucket
	Delivered int64 `json:"delivered,required"`
	// Hard failures in this bucket
	HardFailed int64 `json:"hard_failed,required"`
	// Emails held in this bucket
	Held int64 `json:"held,required"`
	// Emails sent in this bucket
	Sent int64 `json:"sent,required"`
	// Soft failures in this bucket
	SoftFailed int64 `json:"soft_failed,required"`
	// Start of time bucket
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Bounced     respjson.Field
		Delivered   respjson.Field
		HardFailed  respjson.Field
		Held        respjson.Field
		Sent        respjson.Field
		SoftFailed  respjson.Field
		Timestamp   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Single timeseries data point

func (TenantUsageTimeseriesData) RawJSON added in v0.18.0

func (r TenantUsageTimeseriesData) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantUsageTimeseriesData) UnmarshalJSON added in v0.18.0

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

type TenantUsageTimeseriesGranularity added in v0.18.0

type TenantUsageTimeseriesGranularity string

Time bucket granularity

const (
	TenantUsageTimeseriesGranularityHour  TenantUsageTimeseriesGranularity = "hour"
	TenantUsageTimeseriesGranularityDay   TenantUsageTimeseriesGranularity = "day"
	TenantUsageTimeseriesGranularityWeek  TenantUsageTimeseriesGranularity = "week"
	TenantUsageTimeseriesGranularityMonth TenantUsageTimeseriesGranularity = "month"
)

type TenantWebhookDeleteParams added in v0.18.0

type TenantWebhookDeleteParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// contains filtered or unexported fields
}

type TenantWebhookDeleteResponse added in v0.18.0

type TenantWebhookDeleteResponse struct {
	Data    TenantWebhookDeleteResponseData `json:"data,required"`
	Meta    shared.APIMeta                  `json:"meta,required"`
	Success bool                            `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantWebhookDeleteResponse) RawJSON added in v0.18.0

func (r TenantWebhookDeleteResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantWebhookDeleteResponse) UnmarshalJSON added in v0.18.0

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

type TenantWebhookDeleteResponseData added in v0.18.0

type TenantWebhookDeleteResponseData struct {
	Message string `json:"message,required"`
	// 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 (TenantWebhookDeleteResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookDeleteResponseData) UnmarshalJSON added in v0.18.0

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

type TenantWebhookGetDeliveryParams added in v0.18.0

type TenantWebhookGetDeliveryParams struct {
	TenantID  string `path:"tenantId,required" json:"-"`
	WebhookID string `path:"webhookId,required" json:"-"`
	// contains filtered or unexported fields
}

type TenantWebhookGetDeliveryResponse added in v0.18.0

type TenantWebhookGetDeliveryResponse struct {
	// Full details of a webhook delivery including request and response
	Data    TenantWebhookGetDeliveryResponseData `json:"data,required"`
	Meta    shared.APIMeta                       `json:"meta,required"`
	Success bool                                 `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Detailed information about a webhook delivery attempt

func (TenantWebhookGetDeliveryResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookGetDeliveryResponse) UnmarshalJSON added in v0.18.0

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

type TenantWebhookGetDeliveryResponseData added in v0.18.0

type TenantWebhookGetDeliveryResponseData struct {
	// Unique delivery ID (UUID)
	ID string `json:"id,required"`
	// Attempt number for this delivery
	Attempt int64 `json:"attempt,required"`
	// Event type that triggered this delivery
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Event string `json:"event,required"`
	// The request that was sent to your endpoint
	Request TenantWebhookGetDeliveryResponseDataRequest `json:"request,required"`
	// The response received from your endpoint
	Response TenantWebhookGetDeliveryResponseDataResponse `json:"response,required"`
	// HTTP status code returned by the endpoint
	StatusCode int64 `json:"statusCode,required"`
	// Whether the delivery was successful (2xx response)
	Success bool `json:"success,required"`
	// When this delivery attempt occurred
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// URL the webhook was delivered to
	URL string `json:"url,required" format:"uri"`
	// ID of the webhook this delivery belongs to
	WebhookID string `json:"webhookId,required"`
	// Name of the webhook for easy identification
	WebhookName string `json:"webhookName,required"`
	// Whether this delivery will be retried
	WillRetry bool `json:"willRetry,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Attempt     respjson.Field
		Event       respjson.Field
		Request     respjson.Field
		Response    respjson.Field
		StatusCode  respjson.Field
		Success     respjson.Field
		Timestamp   respjson.Field
		URL         respjson.Field
		WebhookID   respjson.Field
		WebhookName respjson.Field
		WillRetry   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Full details of a webhook delivery including request and response

func (TenantWebhookGetDeliveryResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookGetDeliveryResponseData) UnmarshalJSON added in v0.18.0

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

type TenantWebhookGetDeliveryResponseDataRequest added in v0.18.0

type TenantWebhookGetDeliveryResponseDataRequest struct {
	// HTTP headers that were sent with the request
	Headers map[string]string `json:"headers,required"`
	// The complete webhook payload that was sent
	Payload map[string]any `json:"payload,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Headers     respjson.Field
		Payload     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The request that was sent to your endpoint

func (TenantWebhookGetDeliveryResponseDataRequest) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookGetDeliveryResponseDataRequest) UnmarshalJSON added in v0.18.0

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

type TenantWebhookGetDeliveryResponseDataResponse added in v0.18.0

type TenantWebhookGetDeliveryResponseDataResponse struct {
	// HTTP status code from your endpoint
	StatusCode int64 `json:"statusCode,required"`
	// Response body from your endpoint (may be truncated)
	Body string `json:"body,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		StatusCode  respjson.Field
		Body        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The response received from your endpoint

func (TenantWebhookGetDeliveryResponseDataResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookGetDeliveryResponseDataResponse) UnmarshalJSON added in v0.18.0

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

type TenantWebhookGetParams added in v0.18.0

type TenantWebhookGetParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// contains filtered or unexported fields
}

type TenantWebhookGetResponse added in v0.18.0

type TenantWebhookGetResponse struct {
	Data    TenantWebhookGetResponseData `json:"data,required"`
	Meta    shared.APIMeta               `json:"meta,required"`
	Success bool                         `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantWebhookGetResponse) RawJSON added in v0.18.0

func (r TenantWebhookGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantWebhookGetResponse) UnmarshalJSON added in v0.18.0

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

type TenantWebhookGetResponseData added in v0.18.0

type TenantWebhookGetResponseData struct {
	// Webhook ID
	ID string `json:"id,required"`
	// Whether subscribed to all events
	AllEvents bool      `json:"allEvents,required"`
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// Whether the webhook is active
	Enabled bool `json:"enabled,required"`
	// Subscribed events
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Events []string `json:"events,required"`
	// Webhook name for identification
	Name string `json:"name,required"`
	// Webhook endpoint URL
	URL  string `json:"url,required" format:"uri"`
	Uuid string `json:"uuid,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		AllEvents   respjson.Field
		CreatedAt   respjson.Field
		Enabled     respjson.Field
		Events      respjson.Field
		Name        respjson.Field
		URL         respjson.Field
		Uuid        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantWebhookGetResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookGetResponseData) UnmarshalJSON added in v0.18.0

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

type TenantWebhookListDeliveriesParams added in v0.18.0

type TenantWebhookListDeliveriesParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// Only deliveries after this Unix timestamp
	After param.Opt[int64] `query:"after,omitzero" json:"-"`
	// Only deliveries before this Unix timestamp
	Before param.Opt[int64] `query:"before,omitzero" json:"-"`
	// Page number (default 1)
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Items per page (default 30, max 100)
	PerPage param.Opt[int64] `query:"perPage,omitzero" json:"-"`
	// Filter by delivery success (true = 2xx response, false = non-2xx or error)
	Success param.Opt[bool] `query:"success,omitzero" json:"-"`
	// Filter by event type
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Event TenantWebhookListDeliveriesParamsEvent `query:"event,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TenantWebhookListDeliveriesParams) URLQuery added in v0.18.0

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

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

type TenantWebhookListDeliveriesParamsEvent added in v0.18.0

type TenantWebhookListDeliveriesParamsEvent string

Filter by event type

const (
	TenantWebhookListDeliveriesParamsEventMessageSent           TenantWebhookListDeliveriesParamsEvent = "MessageSent"
	TenantWebhookListDeliveriesParamsEventMessageDelayed        TenantWebhookListDeliveriesParamsEvent = "MessageDelayed"
	TenantWebhookListDeliveriesParamsEventMessageDeliveryFailed TenantWebhookListDeliveriesParamsEvent = "MessageDeliveryFailed"
	TenantWebhookListDeliveriesParamsEventMessageHeld           TenantWebhookListDeliveriesParamsEvent = "MessageHeld"
	TenantWebhookListDeliveriesParamsEventMessageBounced        TenantWebhookListDeliveriesParamsEvent = "MessageBounced"
	TenantWebhookListDeliveriesParamsEventMessageLinkClicked    TenantWebhookListDeliveriesParamsEvent = "MessageLinkClicked"
	TenantWebhookListDeliveriesParamsEventMessageLoaded         TenantWebhookListDeliveriesParamsEvent = "MessageLoaded"
	TenantWebhookListDeliveriesParamsEventDomainDNSError        TenantWebhookListDeliveriesParamsEvent = "DomainDNSError"
)

type TenantWebhookListDeliveriesResponse added in v0.18.0

type TenantWebhookListDeliveriesResponse struct {
	Data []TenantWebhookListDeliveriesResponseData `json:"data,required"`
	Meta shared.APIMeta                            `json:"meta,required"`
	// Current page number
	Page int64 `json:"page,required"`
	// Items per page
	PerPage int64 `json:"perPage,required"`
	// Total number of deliveries matching the filter
	Total int64 `json:"total,required"`
	// Total number of pages
	TotalPages int64 `json:"totalPages,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Page        respjson.Field
		PerPage     respjson.Field
		Total       respjson.Field
		TotalPages  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Paginated list of webhook delivery attempts

func (TenantWebhookListDeliveriesResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookListDeliveriesResponse) UnmarshalJSON added in v0.18.0

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

type TenantWebhookListDeliveriesResponseData added in v0.18.0

type TenantWebhookListDeliveriesResponseData struct {
	// Unique delivery ID (UUID)
	ID string `json:"id,required"`
	// Attempt number (1 for first attempt, increments with retries)
	Attempt int64 `json:"attempt,required"`
	// Event type that triggered this delivery
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Event string `json:"event,required"`
	// HTTP status code returned by the endpoint (null if connection failed)
	StatusCode int64 `json:"statusCode,required"`
	// Whether the delivery was successful (2xx response)
	Success bool `json:"success,required"`
	// When this delivery attempt occurred
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// URL the webhook was delivered to
	URL string `json:"url,required" format:"uri"`
	// ID of the webhook this delivery belongs to
	WebhookID string `json:"webhookId,required"`
	// Whether this delivery will be retried (true if failed and retries remaining)
	WillRetry bool `json:"willRetry,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Attempt     respjson.Field
		Event       respjson.Field
		StatusCode  respjson.Field
		Success     respjson.Field
		Timestamp   respjson.Field
		URL         respjson.Field
		WebhookID   respjson.Field
		WillRetry   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Summary of a webhook delivery attempt

func (TenantWebhookListDeliveriesResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookListDeliveriesResponseData) UnmarshalJSON added in v0.18.0

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

type TenantWebhookListResponse added in v0.18.0

type TenantWebhookListResponse struct {
	Data    TenantWebhookListResponseData `json:"data,required"`
	Meta    shared.APIMeta                `json:"meta,required"`
	Success bool                          `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantWebhookListResponse) RawJSON added in v0.18.0

func (r TenantWebhookListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantWebhookListResponse) UnmarshalJSON added in v0.18.0

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

type TenantWebhookListResponseData added in v0.18.0

type TenantWebhookListResponseData struct {
	Webhooks []TenantWebhookListResponseDataWebhook `json:"webhooks,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Webhooks    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantWebhookListResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookListResponseData) UnmarshalJSON added in v0.18.0

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

type TenantWebhookListResponseDataWebhook added in v0.18.0

type TenantWebhookListResponseDataWebhook struct {
	// Webhook ID
	ID      string   `json:"id,required"`
	Enabled bool     `json:"enabled,required"`
	Events  []string `json:"events,required"`
	Name    string   `json:"name,required"`
	URL     string   `json:"url,required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Enabled     respjson.Field
		Events      respjson.Field
		Name        respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantWebhookListResponseDataWebhook) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookListResponseDataWebhook) UnmarshalJSON added in v0.18.0

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

type TenantWebhookNewParams added in v0.18.0

type TenantWebhookNewParams struct {
	// Webhook name for identification
	Name string `json:"name,required"`
	// HTTPS endpoint URL
	URL string `json:"url,required" format:"uri"`
	// Subscribe to all events (ignores events array, accepts null)
	AllEvents param.Opt[bool] `json:"allEvents,omitzero"`
	// Whether the webhook is enabled (accepts null)
	Enabled param.Opt[bool] `json:"enabled,omitzero"`
	// Events to subscribe to (accepts null):
	//
	// - `MessageSent` - Email successfully delivered to recipient's server
	// - `MessageDelayed` - Temporary delivery failure, will retry
	// - `MessageDeliveryFailed` - Permanent delivery failure
	// - `MessageHeld` - Email held for manual review
	// - `MessageBounced` - Email bounced back
	// - `MessageLinkClicked` - Recipient clicked a tracked link
	// - `MessageLoaded` - Recipient opened the email (tracking pixel loaded)
	// - `DomainDNSError` - DNS configuration issue detected
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Events []string `json:"events,omitzero"`
	// contains filtered or unexported fields
}

func (TenantWebhookNewParams) MarshalJSON added in v0.18.0

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

func (*TenantWebhookNewParams) UnmarshalJSON added in v0.18.0

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

type TenantWebhookNewResponse added in v0.18.0

type TenantWebhookNewResponse struct {
	Data    TenantWebhookNewResponseData `json:"data,required"`
	Meta    shared.APIMeta               `json:"meta,required"`
	Success bool                         `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantWebhookNewResponse) RawJSON added in v0.18.0

func (r TenantWebhookNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantWebhookNewResponse) UnmarshalJSON added in v0.18.0

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

type TenantWebhookNewResponseData added in v0.18.0

type TenantWebhookNewResponseData struct {
	// Webhook ID
	ID string `json:"id,required"`
	// Whether subscribed to all events
	AllEvents bool      `json:"allEvents,required"`
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// Whether the webhook is active
	Enabled bool `json:"enabled,required"`
	// Subscribed events
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Events []string `json:"events,required"`
	// Webhook name for identification
	Name string `json:"name,required"`
	// Webhook endpoint URL
	URL  string `json:"url,required" format:"uri"`
	Uuid string `json:"uuid,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		AllEvents   respjson.Field
		CreatedAt   respjson.Field
		Enabled     respjson.Field
		Events      respjson.Field
		Name        respjson.Field
		URL         respjson.Field
		Uuid        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantWebhookNewResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookNewResponseData) UnmarshalJSON added in v0.18.0

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

type TenantWebhookReplayDeliveryParams added in v0.18.0

type TenantWebhookReplayDeliveryParams struct {
	TenantID  string `path:"tenantId,required" json:"-"`
	WebhookID string `path:"webhookId,required" json:"-"`
	// contains filtered or unexported fields
}

type TenantWebhookReplayDeliveryResponse added in v0.18.0

type TenantWebhookReplayDeliveryResponse struct {
	Data    TenantWebhookReplayDeliveryResponseData `json:"data,required"`
	Meta    shared.APIMeta                          `json:"meta,required"`
	Success bool                                    `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Result of replaying a webhook delivery

func (TenantWebhookReplayDeliveryResponse) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookReplayDeliveryResponse) UnmarshalJSON added in v0.18.0

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

type TenantWebhookReplayDeliveryResponseData added in v0.18.0

type TenantWebhookReplayDeliveryResponseData struct {
	// Request duration in milliseconds
	Duration int64 `json:"duration,required"`
	// ID of the new delivery created by the replay
	NewDeliveryID string `json:"newDeliveryId,required"`
	// ID of the original delivery that was replayed
	OriginalDeliveryID string `json:"originalDeliveryId,required"`
	// HTTP status code from your endpoint
	StatusCode int64 `json:"statusCode,required"`
	// Whether the replay was successful (2xx response from endpoint)
	Success bool `json:"success,required"`
	// When the replay was executed
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Duration           respjson.Field
		NewDeliveryID      respjson.Field
		OriginalDeliveryID respjson.Field
		StatusCode         respjson.Field
		Success            respjson.Field
		Timestamp          respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantWebhookReplayDeliveryResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookReplayDeliveryResponseData) UnmarshalJSON added in v0.18.0

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

type TenantWebhookService added in v0.18.0

type TenantWebhookService struct {
	Options []option.RequestOption
}

TenantWebhookService contains methods and other services that help with interacting with the ark 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 NewTenantWebhookService method instead.

func NewTenantWebhookService added in v0.18.0

func NewTenantWebhookService(opts ...option.RequestOption) (r TenantWebhookService)

NewTenantWebhookService 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 (*TenantWebhookService) Delete added in v0.18.0

Delete a webhook

func (*TenantWebhookService) Get added in v0.18.0

Get webhook details

func (*TenantWebhookService) GetDelivery added in v0.18.0

Get detailed information about a specific webhook delivery attempt.

Returns:

- The complete request payload that was sent - Request headers including the signature - Response status code and body from your endpoint - Timing information

Use this to debug why a delivery failed or verify what data was sent.

func (*TenantWebhookService) List added in v0.18.0

func (r *TenantWebhookService) List(ctx context.Context, tenantID string, opts ...option.RequestOption) (res *TenantWebhookListResponse, err error)

Get all configured webhook endpoints for a tenant.

func (*TenantWebhookService) ListDeliveries added in v0.18.0

Get a paginated list of delivery attempts for a specific webhook.

Use this to:

- Monitor webhook health and delivery success rate - Debug failed deliveries - Find specific events to replay

**Filtering:**

- Filter by success/failure to find problematic deliveries - Filter by event type to find specific events - Filter by time range for debugging recent issues

**Retry behavior:** Failed deliveries are automatically retried with exponential backoff over ~3 days. Check `willRetry` to see if more attempts are scheduled.

func (*TenantWebhookService) New added in v0.18.0

Create a webhook endpoint to receive email event notifications for a tenant.

**Available events:**

- `MessageSent` - Email accepted by recipient server - `MessageDeliveryFailed` - Delivery permanently failed - `MessageDelayed` - Delivery temporarily failed, will retry - `MessageBounced` - Email bounced - `MessageHeld` - Email held for review - `MessageLinkClicked` - Recipient clicked a link - `MessageLoaded` - Recipient opened the email - `DomainDNSError` - Domain DNS issue detected

func (*TenantWebhookService) ReplayDelivery added in v0.18.0

Re-send a webhook delivery to your endpoint.

**Use cases:**

- Recover from transient failures after fixing your endpoint - Test endpoint changes with real historical data - Retry deliveries that failed due to downtime

**How it works:**

1. Fetches the original payload from the delivery 2. Generates a new timestamp and signature 3. Sends to your webhook URL immediately 4. Returns the result (does not queue for retry if it fails)

**Note:** The webhook must be enabled to replay deliveries.

func (*TenantWebhookService) Test added in v0.18.0

Send a test payload to your webhook endpoint and verify it receives the data correctly.

Use this to:

- Verify your webhook URL is accessible - Test your signature verification code - Ensure your server handles the payload format correctly

**Test payload format:** The test payload is identical to real webhook payloads, containing sample data for the specified event type. Your webhook should respond with a 2xx status code.

func (*TenantWebhookService) Update added in v0.18.0

Update a webhook

type TenantWebhookTestParams added in v0.18.0

type TenantWebhookTestParams struct {
	TenantID string `path:"tenantId,required" json:"-"`
	// Event type to simulate
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Event TenantWebhookTestParamsEvent `json:"event,omitzero,required"`
	// contains filtered or unexported fields
}

func (TenantWebhookTestParams) MarshalJSON added in v0.18.0

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

func (*TenantWebhookTestParams) UnmarshalJSON added in v0.18.0

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

type TenantWebhookTestParamsEvent added in v0.18.0

type TenantWebhookTestParamsEvent string

Event type to simulate

const (
	TenantWebhookTestParamsEventMessageSent           TenantWebhookTestParamsEvent = "MessageSent"
	TenantWebhookTestParamsEventMessageDelayed        TenantWebhookTestParamsEvent = "MessageDelayed"
	TenantWebhookTestParamsEventMessageDeliveryFailed TenantWebhookTestParamsEvent = "MessageDeliveryFailed"
	TenantWebhookTestParamsEventMessageHeld           TenantWebhookTestParamsEvent = "MessageHeld"
	TenantWebhookTestParamsEventMessageBounced        TenantWebhookTestParamsEvent = "MessageBounced"
	TenantWebhookTestParamsEventMessageLinkClicked    TenantWebhookTestParamsEvent = "MessageLinkClicked"
	TenantWebhookTestParamsEventMessageLoaded         TenantWebhookTestParamsEvent = "MessageLoaded"
	TenantWebhookTestParamsEventDomainDNSError        TenantWebhookTestParamsEvent = "DomainDNSError"
)

type TenantWebhookTestResponse added in v0.18.0

type TenantWebhookTestResponse struct {
	Data    TenantWebhookTestResponseData `json:"data,required"`
	Meta    shared.APIMeta                `json:"meta,required"`
	Success bool                          `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantWebhookTestResponse) RawJSON added in v0.18.0

func (r TenantWebhookTestResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantWebhookTestResponse) UnmarshalJSON added in v0.18.0

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

type TenantWebhookTestResponseData added in v0.18.0

type TenantWebhookTestResponseData struct {
	// Request duration in milliseconds
	Duration int64 `json:"duration,required"`
	// Event type that was tested
	Event string `json:"event,required"`
	// HTTP status code from the webhook endpoint
	StatusCode int64 `json:"statusCode,required"`
	// Whether the webhook endpoint responded with a 2xx status
	Success bool `json:"success,required"`
	// Response body from the webhook endpoint (truncated if too long)
	Body string `json:"body,nullable"`
	// Error message if the request failed
	Error string `json:"error,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Duration    respjson.Field
		Event       respjson.Field
		StatusCode  respjson.Field
		Success     respjson.Field
		Body        respjson.Field
		Error       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantWebhookTestResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookTestResponseData) UnmarshalJSON added in v0.18.0

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

type TenantWebhookUpdateParams added in v0.18.0

type TenantWebhookUpdateParams struct {
	TenantID  string            `path:"tenantId,required" json:"-"`
	AllEvents param.Opt[bool]   `json:"allEvents,omitzero"`
	Enabled   param.Opt[bool]   `json:"enabled,omitzero"`
	Name      param.Opt[string] `json:"name,omitzero"`
	URL       param.Opt[string] `json:"url,omitzero" format:"uri"`
	Events    []string          `json:"events,omitzero"`
	// contains filtered or unexported fields
}

func (TenantWebhookUpdateParams) MarshalJSON added in v0.18.0

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

func (*TenantWebhookUpdateParams) UnmarshalJSON added in v0.18.0

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

type TenantWebhookUpdateResponse added in v0.18.0

type TenantWebhookUpdateResponse struct {
	Data    TenantWebhookUpdateResponseData `json:"data,required"`
	Meta    shared.APIMeta                  `json:"meta,required"`
	Success bool                            `json:"success,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Meta        respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantWebhookUpdateResponse) RawJSON added in v0.18.0

func (r TenantWebhookUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TenantWebhookUpdateResponse) UnmarshalJSON added in v0.18.0

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

type TenantWebhookUpdateResponseData added in v0.18.0

type TenantWebhookUpdateResponseData struct {
	// Webhook ID
	ID string `json:"id,required"`
	// Whether subscribed to all events
	AllEvents bool      `json:"allEvents,required"`
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// Whether the webhook is active
	Enabled bool `json:"enabled,required"`
	// Subscribed events
	//
	// Any of "MessageSent", "MessageDelayed", "MessageDeliveryFailed", "MessageHeld",
	// "MessageBounced", "MessageLinkClicked", "MessageLoaded", "DomainDNSError".
	Events []string `json:"events,required"`
	// Webhook name for identification
	Name string `json:"name,required"`
	// Webhook endpoint URL
	URL  string `json:"url,required" format:"uri"`
	Uuid string `json:"uuid,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		AllEvents   respjson.Field
		CreatedAt   respjson.Field
		Enabled     respjson.Field
		Events      respjson.Field
		Name        respjson.Field
		URL         respjson.Field
		Uuid        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TenantWebhookUpdateResponseData) RawJSON added in v0.18.0

Returns the unmodified JSON received from the API

func (*TenantWebhookUpdateResponseData) UnmarshalJSON added in v0.18.0

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

type TrackDomain

type TrackDomain struct {
	// Track domain ID
	ID string `json:"id,required"`
	// When the track domain was created
	CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
	// Whether the tracking CNAME record is correctly configured. Must be true to use
	// tracking features.
	DNSOk bool `json:"dnsOk,required"`
	// ID of the parent sending domain
	DomainID string `json:"domainId,required"`
	// Full domain name
	FullName string `json:"fullName,required"`
	// Subdomain name
	Name string `json:"name,required"`
	// Whether SSL is enabled for tracking URLs
	SslEnabled bool `json:"sslEnabled,required"`
	// Whether click tracking is enabled
	TrackClicks bool `json:"trackClicks,required"`
	// Whether open tracking is enabled
	TrackOpens bool `json:"trackOpens,required"`
	// When DNS was last checked
	DNSCheckedAt time.Time `json:"dnsCheckedAt,nullable" format:"date-time"`
	// DNS error message if verification failed
	DNSError string `json:"dnsError,nullable"`
	// Required DNS record configuration
	DNSRecord TrackDomainDNSRecord `json:"dnsRecord,nullable"`
	// Current DNS verification status
	//
	// Any of "ok", "missing", "invalid".
	DNSStatus TrackDomainDNSStatus `json:"dnsStatus,nullable"`
	// Domains excluded from click tracking
	ExcludedClickDomains string `json:"excludedClickDomains,nullable"`
	// When the track domain was last updated
	UpdatedAt time.Time `json:"updatedAt,nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                   respjson.Field
		CreatedAt            respjson.Field
		DNSOk                respjson.Field
		DomainID             respjson.Field
		FullName             respjson.Field
		Name                 respjson.Field
		SslEnabled           respjson.Field
		TrackClicks          respjson.Field
		TrackOpens           respjson.Field
		DNSCheckedAt         respjson.Field
		DNSError             respjson.Field
		DNSRecord            respjson.Field
		DNSStatus            respjson.Field
		ExcludedClickDomains respjson.Field
		UpdatedAt            respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TrackDomain) RawJSON

func (r TrackDomain) RawJSON() string

Returns the unmodified JSON received from the API

func (*TrackDomain) UnmarshalJSON

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

type TrackDomainDNSRecord

type TrackDomainDNSRecord struct {
	// DNS record name
	Name string `json:"name"`
	// DNS record type
	Type string `json:"type"`
	// DNS record value (target)
	Value string `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name        respjson.Field
		Type        respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Required DNS record configuration

func (TrackDomainDNSRecord) RawJSON

func (r TrackDomainDNSRecord) RawJSON() string

Returns the unmodified JSON received from the API

func (*TrackDomainDNSRecord) UnmarshalJSON

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

type TrackDomainDNSStatus

type TrackDomainDNSStatus string

Current DNS verification status

const (
	TrackDomainDNSStatusOk      TrackDomainDNSStatus = "ok"
	TrackDomainDNSStatusMissing TrackDomainDNSStatus = "missing"
	TrackDomainDNSStatusInvalid TrackDomainDNSStatus = "invalid"
)

type UsageExportParams added in v0.18.0

type UsageExportParams struct {
	// Only include tenants with at least this many emails sent
	MinSent param.Opt[int64] `query:"minSent,omitzero" json:"-"`
	// Time period for export.
	//
	// **Shortcuts:** `this_month`, `last_month`, `last_30_days`, etc.
	//
	// **Month format:** `2024-01` (YYYY-MM)
	//
	// **Custom range:** `2024-01-01..2024-01-15`
	Period param.Opt[string] `query:"period,omitzero" json:"-"`
	// Timezone for period calculations (IANA format)
	Timezone param.Opt[string] `query:"timezone,omitzero" json:"-"`
	// Export format
	//
	// Any of "csv", "jsonl".
	Format UsageExportParamsFormat `query:"format,omitzero" json:"-"`
	// Filter by tenant status
	//
	// Any of "active", "suspended", "archived".
	Status UsageExportParamsStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (UsageExportParams) URLQuery added in v0.18.0

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

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

type UsageExportParamsFormat added in v0.18.0

type UsageExportParamsFormat string

Export format

const (
	UsageExportParamsFormatCsv   UsageExportParamsFormat = "csv"
	UsageExportParamsFormatJSONL UsageExportParamsFormat = "jsonl"
)

type UsageExportParamsStatus added in v0.18.0

type UsageExportParamsStatus string

Filter by tenant status

const (
	UsageExportParamsStatusActive    UsageExportParamsStatus = "active"
	UsageExportParamsStatusSuspended UsageExportParamsStatus = "suspended"
	UsageExportParamsStatusArchived  UsageExportParamsStatus = "archived"
)

type UsageExportResponse added in v0.18.0

type UsageExportResponse struct {
	// Bounce rate (0-1)
	BounceRate float64 `json:"bounce_rate,required"`
	// Emails that bounced
	Bounced int64 `json:"bounced,required"`
	// Emails successfully delivered
	Delivered int64 `json:"delivered,required"`
	// Delivery rate (0-1)
	DeliveryRate float64 `json:"delivery_rate,required"`
	// Emails that hard-failed
	HardFailed int64 `json:"hard_failed,required"`
	// Emails currently held
	Held int64 `json:"held,required"`
	// Total emails sent
	Sent int64 `json:"sent,required"`
	// Emails that soft-failed
	SoftFailed int64 `json:"soft_failed,required"`
	// Current tenant status
	//
	// Any of "active", "suspended", "archived".
	Status UsageExportResponseStatus `json:"status,required"`
	// Unique tenant identifier
	TenantID string `json:"tenant_id,required"`
	// Tenant display name
	TenantName string `json:"tenant_name,required"`
	// Your external ID for this tenant
	ExternalID string `json:"external_id,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BounceRate   respjson.Field
		Bounced      respjson.Field
		Delivered    respjson.Field
		DeliveryRate respjson.Field
		HardFailed   respjson.Field
		Held         respjson.Field
		Sent         respjson.Field
		SoftFailed   respjson.Field
		Status       respjson.Field
		TenantID     respjson.Field
		TenantName   respjson.Field
		ExternalID   respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Single row in usage export (JSON format)

func (UsageExportResponse) RawJSON added in v0.18.0

func (r UsageExportResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*UsageExportResponse) UnmarshalJSON added in v0.18.0

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

type UsageExportResponseStatus added in v0.18.0

type UsageExportResponseStatus string

Current tenant status

const (
	UsageExportResponseStatusActive    UsageExportResponseStatus = "active"
	UsageExportResponseStatusSuspended UsageExportResponseStatus = "suspended"
	UsageExportResponseStatusArchived  UsageExportResponseStatus = "archived"
)

type UsageGetParams added in v0.18.0

type UsageGetParams struct {
	// Time period for usage data.
	//
	// **Shortcuts:** `today`, `yesterday`, `this_week`, `last_week`, `this_month`,
	// `last_month`, `last_7_days`, `last_30_days`, `last_90_days`
	//
	// **Month format:** `2024-01` (YYYY-MM)
	//
	// **Custom range:** `2024-01-01..2024-01-15`
	Period param.Opt[string] `query:"period,omitzero" json:"-"`
	// Timezone for period calculations (IANA format)
	Timezone param.Opt[string] `query:"timezone,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (UsageGetParams) URLQuery added in v0.18.0

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

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

type UsageListTenantsParams added in v0.18.0

type UsageListTenantsParams struct {
	// Only include tenants with at least this many emails sent
	MinSent param.Opt[int64] `query:"minSent,omitzero" json:"-"`
	// Page number (1-indexed)
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Time period for usage data. Defaults to current month.
	//
	// **Shortcuts:** `today`, `yesterday`, `this_week`, `last_week`, `this_month`,
	// `last_month`, `last_7_days`, `last_30_days`, `last_90_days`
	//
	// **Month format:** `2024-01` (YYYY-MM)
	//
	// **Custom range:** `2024-01-01..2024-01-15`
	Period param.Opt[string] `query:"period,omitzero" json:"-"`
	// Results per page (max 100)
	PerPage param.Opt[int64] `query:"perPage,omitzero" json:"-"`
	// Timezone for period calculations (IANA format). Defaults to UTC.
	Timezone param.Opt[string] `query:"timezone,omitzero" json:"-"`
	// Sort order for results. Prefix with `-` for descending order.
	//
	// Any of "sent", "-sent", "delivered", "-delivered", "bounce_rate",
	// "-bounce_rate", "delivery_rate", "-delivery_rate", "tenant_name",
	// "-tenant_name".
	Sort UsageListTenantsParamsSort `query:"sort,omitzero" json:"-"`
	// Filter by tenant status
	//
	// Any of "active", "suspended", "archived".
	Status UsageListTenantsParamsStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (UsageListTenantsParams) URLQuery added in v0.18.0

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

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

type UsageListTenantsParamsSort added in v0.18.0

type UsageListTenantsParamsSort string

Sort order for results. Prefix with `-` for descending order.

const (
	UsageListTenantsParamsSortSent              UsageListTenantsParamsSort = "sent"
	UsageListTenantsParamsSortMinusSent         UsageListTenantsParamsSort = "-sent"
	UsageListTenantsParamsSortDelivered         UsageListTenantsParamsSort = "delivered"
	UsageListTenantsParamsSortMinusDelivered    UsageListTenantsParamsSort = "-delivered"
	UsageListTenantsParamsSortBounceRate        UsageListTenantsParamsSort = "bounce_rate"
	UsageListTenantsParamsSortMinusBounceRate   UsageListTenantsParamsSort = "-bounce_rate"
	UsageListTenantsParamsSortDeliveryRate      UsageListTenantsParamsSort = "delivery_rate"
	UsageListTenantsParamsSortMinusDeliveryRate UsageListTenantsParamsSort = "-delivery_rate"
	UsageListTenantsParamsSortTenantName        UsageListTenantsParamsSort = "tenant_name"
	UsageListTenantsParamsSortMinusTenantName   UsageListTenantsParamsSort = "-tenant_name"
)

type UsageListTenantsParamsStatus added in v0.18.0

type UsageListTenantsParamsStatus string

Filter by tenant status

const (
	UsageListTenantsParamsStatusActive    UsageListTenantsParamsStatus = "active"
	UsageListTenantsParamsStatusSuspended UsageListTenantsParamsStatus = "suspended"
	UsageListTenantsParamsStatusArchived  UsageListTenantsParamsStatus = "archived"
)

type UsagePeriod added in v0.18.0

type UsagePeriod struct {
	// Period end (inclusive)
	End time.Time `json:"end,required" format:"date-time"`
	// Period start (inclusive)
	Start time.Time `json:"start,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		End         respjson.Field
		Start       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Time period for usage data

func (UsagePeriod) RawJSON added in v0.18.0

func (r UsagePeriod) RawJSON() string

Returns the unmodified JSON received from the API

func (*UsagePeriod) UnmarshalJSON added in v0.18.0

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

type UsageService added in v0.14.0

type UsageService struct {
	Options []option.RequestOption
}

UsageService contains methods and other services that help with interacting with the ark 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 NewUsageService method instead.

func NewUsageService added in v0.14.0

func NewUsageService(opts ...option.RequestOption) (r UsageService)

NewUsageService 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 (*UsageService) Export added in v0.18.0

func (r *UsageService) Export(ctx context.Context, query UsageExportParams, opts ...option.RequestOption) (res *[]UsageExportResponse, err error)

Export email usage data for all tenants in CSV or JSON Lines format. Designed for billing system integration, data warehousing, and analytics.

**Jobs to be done:**

- Import usage data into billing systems (Stripe, Chargebee, etc.) - Load into data warehouses (Snowflake, BigQuery, etc.) - Process in spreadsheets (Excel, Google Sheets) - Feed into BI tools (Looker, Metabase, etc.)

**Export formats:**

- `csv` - UTF-8 with BOM for Excel compatibility (default) - `jsonl` - JSON Lines (one JSON object per line, streamable)

**CSV columns:** `tenant_id`, `tenant_name`, `external_id`, `status`, `sent`, `delivered`, `soft_failed`, `hard_failed`, `bounced`, `held`, `delivery_rate`, `bounce_rate`, `period_start`, `period_end`

**Response headers:**

- `Content-Disposition` - Filename for download - `Content-Type` - `text/csv` or `application/x-ndjson`

func (*UsageService) Get added in v0.14.0

func (r *UsageService) Get(ctx context.Context, query UsageGetParams, opts ...option.RequestOption) (res *OrgUsageSummary, err error)

Returns aggregated email sending statistics for your entire organization. For per-tenant breakdown, use `GET /usage/tenants`.

**Use cases:**

- Platform dashboards showing org-wide metrics - Quick health check on overall sending - Monitoring total volume and delivery rates

**Response includes:**

- `emails` - Aggregated email counts across all tenants - `rates` - Overall delivery and bounce rates - `tenants` - Tenant count summary (total, active, with activity)

**Related endpoints:**

- `GET /usage/tenants` - Paginated usage per tenant - `GET /usage/export` - Export usage data for billing - `GET /tenants/{tenantId}/usage` - Single tenant usage details - `GET /limits` - Rate limits and send limits

func (*UsageService) ListTenants added in v0.18.0

Returns email usage statistics for all tenants in your organization. Results are paginated with page-based navigation.

**Jobs to be done:**

- Generate monthly billing invoices per tenant - Build admin dashboards showing all customer usage - Identify high-volume or problematic tenants - Track usage against plan limits

**Sorting options:**

- `sent`, `-sent` - Sort by emails sent (ascending/descending) - `delivered`, `-delivered` - Sort by emails delivered - `bounce_rate`, `-bounce_rate` - Sort by bounce rate - `tenant_name`, `-tenant_name` - Sort alphabetically by tenant name

**Filtering:**

- `status` - Filter by tenant status (active, suspended, archived) - `minSent` - Only include tenants with at least N emails sent

**Auto-pagination:** SDKs support iterating over all pages automatically.

func (*UsageService) ListTenantsAutoPaging added in v0.18.0

Returns email usage statistics for all tenants in your organization. Results are paginated with page-based navigation.

**Jobs to be done:**

- Generate monthly billing invoices per tenant - Build admin dashboards showing all customer usage - Identify high-volume or problematic tenants - Track usage against plan limits

**Sorting options:**

- `sent`, `-sent` - Sort by emails sent (ascending/descending) - `delivered`, `-delivered` - Sort by emails delivered - `bounce_rate`, `-bounce_rate` - Sort by bounce rate - `tenant_name`, `-tenant_name` - Sort alphabetically by tenant name

**Filtering:**

- `status` - Filter by tenant status (active, suspended, archived) - `minSent` - Only include tenants with at least N emails sent

**Auto-pagination:** SDKs support iterating over all pages automatically.

Directories

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

Jump to

Keyboard shortcuts

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