knock

package module
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

README

Knock Go API Library

Go Reference

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

It is generated with Stainless.

Installation

import (
	"github.com/knocklabs/knock-go" // imported as knock
)

Or to pin the version:

go get -u 'github.com/knocklabs/knock-go@v1.13.0'

Requirements

This library requires Go 1.18+.

Usage

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

package main

import (
	"context"
	"fmt"

	"github.com/knocklabs/knock-go"
	"github.com/knocklabs/knock-go/option"
	"github.com/knocklabs/knock-go/shared"
)

func main() {
	client := knock.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("KNOCK_API_KEY")
	)
	response, err := client.Workflows.Trigger(
		context.TODO(),
		"dinosaurs-loose",
		knock.WorkflowTriggerParams{
			Recipients: knock.F([]knock.RecipientRequestUnionParam{shared.UnionString("dnedry")}),
			Data: knock.F(map[string]interface{}{
				"dinosaur": "triceratops",
			}),
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.WorkflowRunID)
}

Request fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: knock.F("hello"),

	// Explicitly send `"description": null`
	Description: knock.Null[string](),

	Point: knock.F(knock.Point{
		X: knock.Int(0),
		Y: knock.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: knock.Raw[int64](0.01), // sends a float
	}),
}
Response objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the response JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras 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()
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 := knock.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Users.Get(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"}),
)

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.Users.ListAutoPaging(context.TODO(), knock.UserListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	user := iter.Current()
	fmt.Printf("%+v\n", user)
}
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.Users.List(context.TODO(), knock.UserListParams{})
for page != nil {
	for _, user := range page.Entries {
		fmt.Printf("%+v\n", user)
	}
	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 *knock.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.Users.Get(context.TODO(), "dnedry")
if err != nil {
	var apierr *knock.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 "/v1/users/{user_id}": 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.Users.Get(
	ctx,
	"dnedry",
	// 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 param.Field[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 knock.FileParam(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 := knock.NewClient(
	option.WithMaxRetries(0), // default is 2
)

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

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]interface{}

    // 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:   knock.F("id_xxxx"),
    Data: knock.F(FooNewParamsData{
        FirstName: knock.F("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 := knock.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(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (KNOCK_API_KEY, KNOCK_BASE_URL). This should be used to initialize new clients.

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func FileParam

func FileParam(reader io.Reader, filename string, contentType string) param.Field[io.Reader]

FileParam is a param field helper which helps files with a mime content-type.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explicitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type Activity

type Activity struct {
	// Unique identifier for the activity.
	ID string `json:"id"`
	// The typename of the schema.
	Typename string `json:"__typename"`
	// A recipient of a notification, which is either a user or an object.
	Actor Recipient `json:"actor,nullable"`
	// The workflow trigger `data` payload associated with the activity.
	Data map[string]interface{} `json:"data,nullable"`
	// Timestamp when the activity was created.
	InsertedAt time.Time `json:"inserted_at" format:"date-time"`
	// A recipient of a notification, which is either a user or an object.
	Recipient Recipient `json:"recipient"`
	// Timestamp when the activity was last updated.
	UpdatedAt time.Time    `json:"updated_at" format:"date-time"`
	JSON      activityJSON `json:"-"`
}

An activity associated with a workflow trigger request. Messages produced after a [batch step](/designing-workflows/batch-function) can be associated with one or more activities. Non-batched messages will always be associated with a single activity.

func (*Activity) UnmarshalJSON

func (r *Activity) UnmarshalJSON(data []byte) (err error)

type AudienceAddMembersParams

type AudienceAddMembersParams struct {
	// A list of audience members to add.
	Members param.Field[[]AudienceAddMembersParamsMember] `json:"members,required"`
}

func (AudienceAddMembersParams) MarshalJSON

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

type AudienceAddMembersParamsMember

type AudienceAddMembersParamsMember struct {
	// An object containing the user's ID.
	User param.Field[AudienceAddMembersParamsMembersUser] `json:"user,required"`
	// The unique identifier for the tenant.
	Tenant param.Field[string] `json:"tenant"`
}

An audience member.

func (AudienceAddMembersParamsMember) MarshalJSON

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

type AudienceAddMembersParamsMembersUser

type AudienceAddMembersParamsMembersUser struct {
	// The unique identifier of the user.
	ID param.Field[string] `json:"id"`
}

An object containing the user's ID.

func (AudienceAddMembersParamsMembersUser) MarshalJSON

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

type AudienceListMembersResponse

type AudienceListMembersResponse struct {
	// A list of audience members.
	Entries []AudienceMember `json:"entries,required"`
	// Pagination information for a list of resources.
	PageInfo PageInfo                        `json:"page_info,required"`
	JSON     audienceListMembersResponseJSON `json:"-"`
}

A paginated list of audience members.

func (*AudienceListMembersResponse) UnmarshalJSON

func (r *AudienceListMembersResponse) UnmarshalJSON(data []byte) (err error)

type AudienceMember

type AudienceMember struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// Timestamp when the resource was created.
	AddedAt time.Time `json:"added_at,required" format:"date-time"`
	// A [User](/concepts/users) represents an individual in your system who can
	// receive notifications through Knock. Users are the most common recipients of
	// notifications and are always referenced by your internal identifier.
	User User `json:"user,required"`
	// The unique identifier of the user.
	UserID string `json:"user_id,required"`
	// The unique identifier for the tenant.
	Tenant string             `json:"tenant,nullable"`
	JSON   audienceMemberJSON `json:"-"`
}

An audience member.

func (*AudienceMember) UnmarshalJSON

func (r *AudienceMember) UnmarshalJSON(data []byte) (err error)

type AudienceRemoveMembersParams

type AudienceRemoveMembersParams struct {
	// A list of audience members to remove.
	Members param.Field[[]AudienceRemoveMembersParamsMember] `json:"members,required"`
}

func (AudienceRemoveMembersParams) MarshalJSON

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

type AudienceRemoveMembersParamsMember

type AudienceRemoveMembersParamsMember struct {
	// An object containing the user's ID.
	User param.Field[AudienceRemoveMembersParamsMembersUser] `json:"user,required"`
	// The unique identifier for the tenant.
	Tenant param.Field[string] `json:"tenant"`
}

An audience member.

func (AudienceRemoveMembersParamsMember) MarshalJSON

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

type AudienceRemoveMembersParamsMembersUser

type AudienceRemoveMembersParamsMembersUser struct {
	// The unique identifier of the user.
	ID param.Field[string] `json:"id"`
}

An object containing the user's ID.

func (AudienceRemoveMembersParamsMembersUser) MarshalJSON

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

type AudienceService

type AudienceService struct {
	Options []option.RequestOption
}

AudienceService contains methods and other services that help with interacting with the knock 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 NewAudienceService method instead.

func NewAudienceService

func NewAudienceService(opts ...option.RequestOption) (r *AudienceService)

NewAudienceService 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 (*AudienceService) AddMembers

func (r *AudienceService) AddMembers(ctx context.Context, key string, body AudienceAddMembersParams, opts ...option.RequestOption) (res *string, err error)

Adds one or more members to the specified audience.

func (*AudienceService) ListMembers

func (r *AudienceService) ListMembers(ctx context.Context, key string, opts ...option.RequestOption) (res *AudienceListMembersResponse, err error)

Returns a paginated list of members for the specified audience.

func (*AudienceService) RemoveMembers

func (r *AudienceService) RemoveMembers(ctx context.Context, key string, body AudienceRemoveMembersParams, opts ...option.RequestOption) (res *string, err error)

Removes one or more members from the specified audience.

type BulkOperation

type BulkOperation struct {
	// Unique identifier for the bulk operation.
	ID string `json:"id,required" format:"uuid"`
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The estimated total number of rows to process.
	EstimatedTotalRows int64 `json:"estimated_total_rows,required"`
	// Timestamp when the resource was created.
	InsertedAt time.Time `json:"inserted_at,required" format:"date-time"`
	// The name of the bulk operation.
	Name string `json:"name,required"`
	// The number of rows processed so far.
	ProcessedRows int64 `json:"processed_rows,required"`
	// The status of the bulk operation.
	Status BulkOperationStatus `json:"status,required"`
	// The number of successful operations.
	SuccessCount int64 `json:"success_count,required"`
	// The timestamp when the resource was last updated.
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// Timestamp when the bulk operation was completed.
	CompletedAt time.Time `json:"completed_at,nullable" format:"date-time"`
	// The number of failed operations.
	ErrorCount int64 `json:"error_count"`
	// A list of items that failed to be processed.
	ErrorItems []BulkOperationErrorItem `json:"error_items"`
	// Timestamp when the bulk operation failed.
	FailedAt time.Time `json:"failed_at,nullable" format:"date-time"`
	// The URI to the bulk operation's progress.
	ProgressPath string `json:"progress_path" format:"uri"`
	// Timestamp when the bulk operation was started.
	StartedAt time.Time         `json:"started_at,nullable" format:"date-time"`
	JSON      bulkOperationJSON `json:"-"`
}

A bulk operation entity.

func (*BulkOperation) UnmarshalJSON

func (r *BulkOperation) UnmarshalJSON(data []byte) (err error)

type BulkOperationErrorItem

type BulkOperationErrorItem struct {
	// Unique identifier for the object.
	ID string `json:"id,required"`
	// The collection this object belongs to.
	Collection string                     `json:"collection,nullable"`
	JSON       bulkOperationErrorItemJSON `json:"-"`
}

func (*BulkOperationErrorItem) UnmarshalJSON

func (r *BulkOperationErrorItem) UnmarshalJSON(data []byte) (err error)

type BulkOperationService

type BulkOperationService struct {
	Options []option.RequestOption
}

BulkOperationService contains methods and other services that help with interacting with the knock 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 NewBulkOperationService method instead.

func NewBulkOperationService

func NewBulkOperationService(opts ...option.RequestOption) (r *BulkOperationService)

NewBulkOperationService 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 (*BulkOperationService) Get

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

Retrieves a bulk operation (if it exists) and displays the current state of it.

type BulkOperationStatus

type BulkOperationStatus string

The status of the bulk operation.

const (
	BulkOperationStatusQueued     BulkOperationStatus = "queued"
	BulkOperationStatusProcessing BulkOperationStatus = "processing"
	BulkOperationStatusCompleted  BulkOperationStatus = "completed"
	BulkOperationStatusFailed     BulkOperationStatus = "failed"
)

func (BulkOperationStatus) IsKnown

func (r BulkOperationStatus) IsKnown() bool

type ChannelBulkService

type ChannelBulkService struct {
	Options []option.RequestOption
}

ChannelBulkService contains methods and other services that help with interacting with the knock 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 NewChannelBulkService method instead.

func NewChannelBulkService

func NewChannelBulkService(opts ...option.RequestOption) (r *ChannelBulkService)

NewChannelBulkService 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 (*ChannelBulkService) UpdateMessageStatus

Bulk update the status of messages for a specific channel. The channel is specified by the `channel_id` parameter. The action to perform is specified by the `action` parameter, where the action is a status change action (e.g. `archive`, `unarchive`).

type ChannelBulkUpdateMessageStatusParams

type ChannelBulkUpdateMessageStatusParams struct {
	// Limits the results to messages with the given archived status.
	Archived param.Field[ChannelBulkUpdateMessageStatusParamsArchived] `json:"archived"`
	// Limits the results to messages with the given delivery status.
	DeliveryStatus param.Field[ChannelBulkUpdateMessageStatusParamsDeliveryStatus] `json:"delivery_status"`
	// Limits the results to messages with the given engagement status.
	EngagementStatus param.Field[ChannelBulkUpdateMessageStatusParamsEngagementStatus] `json:"engagement_status"`
	// Limits the results to messages that have a tenant or not.
	HasTenant param.Field[bool] `json:"has_tenant"`
	// Limits the results to messages inserted after the given date.
	NewerThan param.Field[time.Time] `json:"newer_than" format:"date-time"`
	// Limits the results to messages inserted before the given date.
	OlderThan param.Field[time.Time] `json:"older_than" format:"date-time"`
	// Limits the results to messages with the given recipient IDs.
	RecipientIDs param.Field[[]string] `json:"recipient_ids"`
	// Limits the results to messages with the given tenant IDs.
	Tenants param.Field[[]string] `json:"tenants"`
	// Limits the results to only messages that were generated with the given data. See
	// [trigger data filtering](/api-reference/overview/trigger-data-filtering) for
	// more information.
	TriggerData param.Field[string] `json:"trigger_data"`
	// Limits the results to messages with the given workflow keys.
	Workflows param.Field[[]string] `json:"workflows"`
}

func (ChannelBulkUpdateMessageStatusParams) MarshalJSON

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

type ChannelBulkUpdateMessageStatusParamsAction

type ChannelBulkUpdateMessageStatusParamsAction string
const (
	ChannelBulkUpdateMessageStatusParamsActionSeen       ChannelBulkUpdateMessageStatusParamsAction = "seen"
	ChannelBulkUpdateMessageStatusParamsActionUnseen     ChannelBulkUpdateMessageStatusParamsAction = "unseen"
	ChannelBulkUpdateMessageStatusParamsActionRead       ChannelBulkUpdateMessageStatusParamsAction = "read"
	ChannelBulkUpdateMessageStatusParamsActionUnread     ChannelBulkUpdateMessageStatusParamsAction = "unread"
	ChannelBulkUpdateMessageStatusParamsActionArchived   ChannelBulkUpdateMessageStatusParamsAction = "archived"
	ChannelBulkUpdateMessageStatusParamsActionUnarchived ChannelBulkUpdateMessageStatusParamsAction = "unarchived"
	ChannelBulkUpdateMessageStatusParamsActionInteracted ChannelBulkUpdateMessageStatusParamsAction = "interacted"
	ChannelBulkUpdateMessageStatusParamsActionArchive    ChannelBulkUpdateMessageStatusParamsAction = "archive"
	ChannelBulkUpdateMessageStatusParamsActionUnarchive  ChannelBulkUpdateMessageStatusParamsAction = "unarchive"
	ChannelBulkUpdateMessageStatusParamsActionDelete     ChannelBulkUpdateMessageStatusParamsAction = "delete"
)

func (ChannelBulkUpdateMessageStatusParamsAction) IsKnown

type ChannelBulkUpdateMessageStatusParamsArchived

type ChannelBulkUpdateMessageStatusParamsArchived string

Limits the results to messages with the given archived status.

const (
	ChannelBulkUpdateMessageStatusParamsArchivedExclude ChannelBulkUpdateMessageStatusParamsArchived = "exclude"
	ChannelBulkUpdateMessageStatusParamsArchivedInclude ChannelBulkUpdateMessageStatusParamsArchived = "include"
	ChannelBulkUpdateMessageStatusParamsArchivedOnly    ChannelBulkUpdateMessageStatusParamsArchived = "only"
)

func (ChannelBulkUpdateMessageStatusParamsArchived) IsKnown

type ChannelBulkUpdateMessageStatusParamsDeliveryStatus

type ChannelBulkUpdateMessageStatusParamsDeliveryStatus string

Limits the results to messages with the given delivery status.

const (
	ChannelBulkUpdateMessageStatusParamsDeliveryStatusQueued            ChannelBulkUpdateMessageStatusParamsDeliveryStatus = "queued"
	ChannelBulkUpdateMessageStatusParamsDeliveryStatusSent              ChannelBulkUpdateMessageStatusParamsDeliveryStatus = "sent"
	ChannelBulkUpdateMessageStatusParamsDeliveryStatusDelivered         ChannelBulkUpdateMessageStatusParamsDeliveryStatus = "delivered"
	ChannelBulkUpdateMessageStatusParamsDeliveryStatusDeliveryAttempted ChannelBulkUpdateMessageStatusParamsDeliveryStatus = "delivery_attempted"
	ChannelBulkUpdateMessageStatusParamsDeliveryStatusUndelivered       ChannelBulkUpdateMessageStatusParamsDeliveryStatus = "undelivered"
	ChannelBulkUpdateMessageStatusParamsDeliveryStatusNotSent           ChannelBulkUpdateMessageStatusParamsDeliveryStatus = "not_sent"
	ChannelBulkUpdateMessageStatusParamsDeliveryStatusBounced           ChannelBulkUpdateMessageStatusParamsDeliveryStatus = "bounced"
)

func (ChannelBulkUpdateMessageStatusParamsDeliveryStatus) IsKnown

type ChannelBulkUpdateMessageStatusParamsEngagementStatus

type ChannelBulkUpdateMessageStatusParamsEngagementStatus string

Limits the results to messages with the given engagement status.

const (
	ChannelBulkUpdateMessageStatusParamsEngagementStatusSeen        ChannelBulkUpdateMessageStatusParamsEngagementStatus = "seen"
	ChannelBulkUpdateMessageStatusParamsEngagementStatusUnseen      ChannelBulkUpdateMessageStatusParamsEngagementStatus = "unseen"
	ChannelBulkUpdateMessageStatusParamsEngagementStatusRead        ChannelBulkUpdateMessageStatusParamsEngagementStatus = "read"
	ChannelBulkUpdateMessageStatusParamsEngagementStatusUnread      ChannelBulkUpdateMessageStatusParamsEngagementStatus = "unread"
	ChannelBulkUpdateMessageStatusParamsEngagementStatusArchived    ChannelBulkUpdateMessageStatusParamsEngagementStatus = "archived"
	ChannelBulkUpdateMessageStatusParamsEngagementStatusUnarchived  ChannelBulkUpdateMessageStatusParamsEngagementStatus = "unarchived"
	ChannelBulkUpdateMessageStatusParamsEngagementStatusLinkClicked ChannelBulkUpdateMessageStatusParamsEngagementStatus = "link_clicked"
	ChannelBulkUpdateMessageStatusParamsEngagementStatusInteracted  ChannelBulkUpdateMessageStatusParamsEngagementStatus = "interacted"
)

func (ChannelBulkUpdateMessageStatusParamsEngagementStatus) IsKnown

type ChannelData

type ChannelData struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The unique identifier for the channel.
	ChannelID string `json:"channel_id,required" format:"uuid"`
	// Channel data for a given channel type.
	Data ChannelDataData `json:"data,required"`
	// The type of provider.
	Provider ChannelDataProvider `json:"provider"`
	JSON     channelDataJSON     `json:"-"`
}

Channel data for a given channel type.

func (*ChannelData) UnmarshalJSON

func (r *ChannelData) UnmarshalJSON(data []byte) (err error)

type ChannelDataData

type ChannelDataData struct {
	// This field can have the runtime type of [SlackChannelDataToken].
	Token interface{} `json:"token"`
	// This field can have the runtime type of [[]SlackChannelDataConnection],
	// [[]MsTeamsChannelDataConnection], [[]DiscordChannelDataConnection].
	Connections interface{} `json:"connections"`
	// Microsoft Teams tenant ID.
	MsTeamsTenantID string `json:"ms_teams_tenant_id,nullable" format:"uuid"`
	// This field can have the runtime type of [[]string].
	PlayerIDs interface{} `json:"player_ids"`
	// This field can have the runtime type of [[]string].
	TargetArns interface{} `json:"target_arns"`
	// This field can have the runtime type of [[]string].
	Tokens interface{}         `json:"tokens"`
	JSON   channelDataDataJSON `json:"-"`
	// contains filtered or unexported fields
}

Channel data for a given channel type.

func (ChannelDataData) AsUnion

AsUnion returns a ChannelDataDataUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are PushChannelData, SlackChannelData, MsTeamsChannelData, DiscordChannelData, OneSignalChannelData, ChannelDataDataAwsSnsPushChannelData.

func (*ChannelDataData) UnmarshalJSON

func (r *ChannelDataData) UnmarshalJSON(data []byte) (err error)

type ChannelDataDataAwsSnsPushChannelData added in v1.13.0

type ChannelDataDataAwsSnsPushChannelData struct {
	// A list of platform endpoint ARNs. See
	// [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html).
	TargetArns []string                                 `json:"target_arns,required"`
	JSON       channelDataDataAwsSnsPushChannelDataJSON `json:"-"`
}

AWS SNS push channel data.

func (*ChannelDataDataAwsSnsPushChannelData) UnmarshalJSON added in v1.13.0

func (r *ChannelDataDataAwsSnsPushChannelData) UnmarshalJSON(data []byte) (err error)

type ChannelDataDataUnion

type ChannelDataDataUnion interface {
	// contains filtered or unexported methods
}

Channel data for a given channel type.

Union satisfied by PushChannelData, SlackChannelData, MsTeamsChannelData, DiscordChannelData, OneSignalChannelData or ChannelDataDataAwsSnsPushChannelData.

type ChannelDataProvider

type ChannelDataProvider string

The type of provider.

const (
	ChannelDataProviderPushFcm          ChannelDataProvider = "push_fcm"
	ChannelDataProviderPushApns         ChannelDataProvider = "push_apns"
	ChannelDataProviderPushAwsSns       ChannelDataProvider = "push_aws_sns"
	ChannelDataProviderPushExpo         ChannelDataProvider = "push_expo"
	ChannelDataProviderPushOneSignal    ChannelDataProvider = "push_one_signal"
	ChannelDataProviderChatSlack        ChannelDataProvider = "chat_slack"
	ChannelDataProviderChatMsTeams      ChannelDataProvider = "chat_ms_teams"
	ChannelDataProviderChatDiscord      ChannelDataProvider = "chat_discord"
	ChannelDataProviderHTTPKnockWebhook ChannelDataProvider = "http_knock_webhook"
)

func (ChannelDataProvider) IsKnown

func (r ChannelDataProvider) IsKnown() bool

type ChannelDataRequestDataAwsSnsPushChannelDataParam added in v1.13.0

type ChannelDataRequestDataAwsSnsPushChannelDataParam struct {
	// A list of platform endpoint ARNs. See
	// [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html).
	TargetArns param.Field[[]string] `json:"target_arns,required"`
}

AWS SNS push channel data.

func (ChannelDataRequestDataAwsSnsPushChannelDataParam) MarshalJSON added in v1.13.0

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

type ChannelDataRequestDataParam

type ChannelDataRequestDataParam struct {
	Token       param.Field[interface{}] `json:"token"`
	Connections param.Field[interface{}] `json:"connections"`
	// Microsoft Teams tenant ID.
	MsTeamsTenantID param.Field[string]      `json:"ms_teams_tenant_id" format:"uuid"`
	PlayerIDs       param.Field[interface{}] `json:"player_ids"`
	TargetArns      param.Field[interface{}] `json:"target_arns"`
	Tokens          param.Field[interface{}] `json:"tokens"`
}

Channel data for a given channel type.

func (ChannelDataRequestDataParam) MarshalJSON

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

type ChannelDataRequestDataUnionParam

type ChannelDataRequestDataUnionParam interface {
	// contains filtered or unexported methods
}

Channel data for a given channel type.

Satisfied by PushChannelDataParam, OneSignalChannelDataParam, ChannelDataRequestDataAwsSnsPushChannelDataParam, SlackChannelDataParam, MsTeamsChannelDataParam, DiscordChannelDataParam, ChannelDataRequestDataParam.

type ChannelDataRequestParam

type ChannelDataRequestParam struct {
	// Channel data for a given channel type.
	Data param.Field[ChannelDataRequestDataUnionParam] `json:"data,required"`
}

A request to set channel data for a type of channel.

func (ChannelDataRequestParam) MarshalJSON

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

type ChannelService

type ChannelService struct {
	Options []option.RequestOption
	Bulk    *ChannelBulkService
}

ChannelService contains methods and other services that help with interacting with the knock 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 NewChannelService method instead.

func NewChannelService

func NewChannelService(opts ...option.RequestOption) (r *ChannelService)

NewChannelService 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 Client

type Client struct {
	Options        []option.RequestOption
	Shared         *SharedService
	Recipients     *RecipientService
	Users          *UserService
	Objects        *ObjectService
	Tenants        *TenantService
	BulkOperations *BulkOperationService
	Messages       *MessageService
	Providers      *ProviderService
	Integrations   *IntegrationService
	Workflows      *WorkflowService
	Schedules      *ScheduleService
	Channels       *ChannelService
	Audiences      *AudienceService
}

Client creates a struct with services and top level methods that help with interacting with the knock 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 (KNOCK_API_KEY, KNOCK_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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 Condition

type Condition struct {
	// The argument value to compare against in the condition.
	Argument string `json:"argument,required,nullable"`
	// The operator to use in the condition evaluation.
	Operator ConditionOperator `json:"operator,required"`
	// The variable to be evaluated in the condition.
	Variable string        `json:"variable,required"`
	JSON     conditionJSON `json:"-"`
}

A condition to be evaluated.

func (*Condition) UnmarshalJSON

func (r *Condition) UnmarshalJSON(data []byte) (err error)

type ConditionOperator

type ConditionOperator string

The operator to use in the condition evaluation.

const (
	ConditionOperatorEqualTo              ConditionOperator = "equal_to"
	ConditionOperatorNotEqualTo           ConditionOperator = "not_equal_to"
	ConditionOperatorGreaterThan          ConditionOperator = "greater_than"
	ConditionOperatorLessThan             ConditionOperator = "less_than"
	ConditionOperatorGreaterThanOrEqualTo ConditionOperator = "greater_than_or_equal_to"
	ConditionOperatorLessThanOrEqualTo    ConditionOperator = "less_than_or_equal_to"
	ConditionOperatorContains             ConditionOperator = "contains"
	ConditionOperatorNotContains          ConditionOperator = "not_contains"
	ConditionOperatorEmpty                ConditionOperator = "empty"
	ConditionOperatorNotEmpty             ConditionOperator = "not_empty"
	ConditionOperatorContainsAll          ConditionOperator = "contains_all"
	ConditionOperatorIsTimestamp          ConditionOperator = "is_timestamp"
	ConditionOperatorIsNotTimestamp       ConditionOperator = "is_not_timestamp"
	ConditionOperatorIsTimestampAfter     ConditionOperator = "is_timestamp_after"
	ConditionOperatorIsTimestampBefore    ConditionOperator = "is_timestamp_before"
	ConditionOperatorIsTimestampBetween   ConditionOperator = "is_timestamp_between"
	ConditionOperatorIsAudienceMember     ConditionOperator = "is_audience_member"
	ConditionOperatorIsNotAudienceMember  ConditionOperator = "is_not_audience_member"
)

func (ConditionOperator) IsKnown

func (r ConditionOperator) IsKnown() bool

type ConditionParam

type ConditionParam struct {
	// The argument value to compare against in the condition.
	Argument param.Field[string] `json:"argument,required"`
	// The operator to use in the condition evaluation.
	Operator param.Field[ConditionOperator] `json:"operator,required"`
	// The variable to be evaluated in the condition.
	Variable param.Field[string] `json:"variable,required"`
}

A condition to be evaluated.

func (ConditionParam) MarshalJSON

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

type DiscordChannelData

type DiscordChannelData struct {
	// List of Discord channel connections.
	Connections []DiscordChannelDataConnection `json:"connections,required"`
	JSON        discordChannelDataJSON         `json:"-"`
}

Discord channel data.

func (*DiscordChannelData) UnmarshalJSON

func (r *DiscordChannelData) UnmarshalJSON(data []byte) (err error)

type DiscordChannelDataConnection

type DiscordChannelDataConnection struct {
	// Discord channel ID.
	ChannelID string `json:"channel_id"`
	// This field can have the runtime type of
	// [DiscordChannelDataConnectionsDiscordIncomingWebhookConnectionIncomingWebhook].
	IncomingWebhook interface{}                      `json:"incoming_webhook"`
	JSON            discordChannelDataConnectionJSON `json:"-"`
	// contains filtered or unexported fields
}

Discord channel connection, either a channel connection or an incoming webhook connection.

func (DiscordChannelDataConnection) AsUnion

AsUnion returns a DiscordChannelDataConnectionsUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are DiscordChannelDataConnectionsDiscordChannelConnection, DiscordChannelDataConnectionsDiscordIncomingWebhookConnection.

func (*DiscordChannelDataConnection) UnmarshalJSON

func (r *DiscordChannelDataConnection) UnmarshalJSON(data []byte) (err error)

type DiscordChannelDataConnectionParam

type DiscordChannelDataConnectionParam struct {
	// Discord channel ID.
	ChannelID       param.Field[string]      `json:"channel_id"`
	IncomingWebhook param.Field[interface{}] `json:"incoming_webhook"`
}

Discord channel connection, either a channel connection or an incoming webhook connection.

func (DiscordChannelDataConnectionParam) MarshalJSON

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

type DiscordChannelDataConnectionsDiscordChannelConnection

type DiscordChannelDataConnectionsDiscordChannelConnection struct {
	// Discord channel ID.
	ChannelID string                                                    `json:"channel_id,required"`
	JSON      discordChannelDataConnectionsDiscordChannelConnectionJSON `json:"-"`
}

Discord channel connection.

func (*DiscordChannelDataConnectionsDiscordChannelConnection) UnmarshalJSON

func (r *DiscordChannelDataConnectionsDiscordChannelConnection) UnmarshalJSON(data []byte) (err error)

type DiscordChannelDataConnectionsDiscordChannelConnectionParam

type DiscordChannelDataConnectionsDiscordChannelConnectionParam struct {
	// Discord channel ID.
	ChannelID param.Field[string] `json:"channel_id,required"`
}

Discord channel connection.

func (DiscordChannelDataConnectionsDiscordChannelConnectionParam) MarshalJSON

type DiscordChannelDataConnectionsDiscordIncomingWebhookConnection

type DiscordChannelDataConnectionsDiscordIncomingWebhookConnection struct {
	// Discord incoming webhook object.
	IncomingWebhook DiscordChannelDataConnectionsDiscordIncomingWebhookConnectionIncomingWebhook `json:"incoming_webhook,required"`
	JSON            discordChannelDataConnectionsDiscordIncomingWebhookConnectionJSON            `json:"-"`
}

Discord incoming webhook connection.

func (*DiscordChannelDataConnectionsDiscordIncomingWebhookConnection) UnmarshalJSON

type DiscordChannelDataConnectionsDiscordIncomingWebhookConnectionIncomingWebhook

type DiscordChannelDataConnectionsDiscordIncomingWebhookConnectionIncomingWebhook struct {
	// Incoming webhook URL.
	URL  string                                                                           `json:"url,required"`
	JSON discordChannelDataConnectionsDiscordIncomingWebhookConnectionIncomingWebhookJSON `json:"-"`
}

Discord incoming webhook object.

func (*DiscordChannelDataConnectionsDiscordIncomingWebhookConnectionIncomingWebhook) UnmarshalJSON

type DiscordChannelDataConnectionsDiscordIncomingWebhookConnectionIncomingWebhookParam

type DiscordChannelDataConnectionsDiscordIncomingWebhookConnectionIncomingWebhookParam struct {
	// Incoming webhook URL.
	URL param.Field[string] `json:"url,required"`
}

Discord incoming webhook object.

func (DiscordChannelDataConnectionsDiscordIncomingWebhookConnectionIncomingWebhookParam) MarshalJSON

type DiscordChannelDataConnectionsDiscordIncomingWebhookConnectionParam

type DiscordChannelDataConnectionsDiscordIncomingWebhookConnectionParam struct {
	// Discord incoming webhook object.
	IncomingWebhook param.Field[DiscordChannelDataConnectionsDiscordIncomingWebhookConnectionIncomingWebhookParam] `json:"incoming_webhook,required"`
}

Discord incoming webhook connection.

func (DiscordChannelDataConnectionsDiscordIncomingWebhookConnectionParam) MarshalJSON

type DiscordChannelDataConnectionsUnion

type DiscordChannelDataConnectionsUnion interface {
	// contains filtered or unexported methods
}

Discord channel connection, either a channel connection or an incoming webhook connection.

Union satisfied by DiscordChannelDataConnectionsDiscordChannelConnection or DiscordChannelDataConnectionsDiscordIncomingWebhookConnection.

type DiscordChannelDataConnectionsUnionParam

type DiscordChannelDataConnectionsUnionParam interface {
	// contains filtered or unexported methods
}

Discord channel connection, either a channel connection or an incoming webhook connection.

Satisfied by DiscordChannelDataConnectionsDiscordChannelConnectionParam, DiscordChannelDataConnectionsDiscordIncomingWebhookConnectionParam, DiscordChannelDataConnectionParam.

type DiscordChannelDataParam

type DiscordChannelDataParam struct {
	// List of Discord channel connections.
	Connections param.Field[[]DiscordChannelDataConnectionsUnionParam] `json:"connections,required"`
}

Discord channel data.

func (DiscordChannelDataParam) MarshalJSON

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

type Error

type Error = apierror.Error

type IdentifyUserRequestParam

type IdentifyUserRequestParam struct {
	// A URL for the avatar of the user.
	Avatar param.Field[string] `json:"avatar"`
	// A request to set channel data for a type of channel inline.
	ChannelData param.Field[InlineChannelDataRequestParam] `json:"channel_data"`
	// The creation date of the user from your system.
	CreatedAt param.Field[time.Time] `json:"created_at" format:"date-time"`
	// The primary email address for the user.
	Email param.Field[string] `json:"email"`
	// The locale of the user. Used for [message localization](/concepts/translations).
	Locale param.Field[string] `json:"locale"`
	// Display name of the user.
	Name param.Field[string] `json:"name"`
	// The [E.164](https://www.twilio.com/docs/glossary/what-e164) phone number of the
	// user (required for SMS channels).
	PhoneNumber param.Field[string] `json:"phone_number"`
	// Inline set preferences for a recipient, where the key is the preference set id.
	// Preferences that are set inline will be merged into any existing preferences
	// rather than replacing them.
	Preferences param.Field[InlinePreferenceSetRequestParam] `json:"preferences"`
	// The timezone of the user. Must be a
	// valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
	// Used
	// for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
	Timezone    param.Field[string]    `json:"timezone"`
	ExtraFields map[string]interface{} `json:"-,extras"`
}

A set of parameters to identify a user with. Does not include the user ID, as that's specified elsewhere in the request. You can supply any additional properties you'd like to upsert for the user.

func (IdentifyUserRequestParam) MarshalJSON

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

type InlineChannelDataRequestItemAwsSnsPushChannelDataParam added in v1.13.0

type InlineChannelDataRequestItemAwsSnsPushChannelDataParam struct {
	// A list of platform endpoint ARNs. See
	// [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html).
	TargetArns param.Field[[]string] `json:"target_arns,required"`
}

AWS SNS push channel data.

func (InlineChannelDataRequestItemAwsSnsPushChannelDataParam) MarshalJSON added in v1.13.0

type InlineChannelDataRequestItemParam added in v1.1.0

type InlineChannelDataRequestItemParam struct {
	Token       param.Field[interface{}] `json:"token"`
	Connections param.Field[interface{}] `json:"connections"`
	// Microsoft Teams tenant ID.
	MsTeamsTenantID param.Field[string]      `json:"ms_teams_tenant_id" format:"uuid"`
	PlayerIDs       param.Field[interface{}] `json:"player_ids"`
	TargetArns      param.Field[interface{}] `json:"target_arns"`
	Tokens          param.Field[interface{}] `json:"tokens"`
}

Channel data for a given channel type.

func (InlineChannelDataRequestItemParam) MarshalJSON added in v1.1.0

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

type InlineChannelDataRequestItemUnionParam added in v1.1.0

type InlineChannelDataRequestItemUnionParam interface {
	// contains filtered or unexported methods
}

Channel data for a given channel type.

Satisfied by PushChannelDataParam, OneSignalChannelDataParam, InlineChannelDataRequestItemAwsSnsPushChannelDataParam, SlackChannelDataParam, MsTeamsChannelDataParam, DiscordChannelDataParam, InlineChannelDataRequestItemParam.

type InlineIdentifyUserRequestParam

type InlineIdentifyUserRequestParam struct {
	// The unique identifier of the user.
	ID param.Field[string] `json:"id,required"`
	// A URL for the avatar of the user.
	Avatar param.Field[string] `json:"avatar"`
	// A request to set channel data for a type of channel inline.
	ChannelData param.Field[InlineChannelDataRequestParam] `json:"channel_data"`
	// The creation date of the user from your system.
	CreatedAt param.Field[time.Time] `json:"created_at" format:"date-time"`
	// The primary email address for the user.
	Email param.Field[string] `json:"email"`
	// The locale of the user. Used for [message localization](/concepts/translations).
	Locale param.Field[string] `json:"locale"`
	// Display name of the user.
	Name param.Field[string] `json:"name"`
	// The [E.164](https://www.twilio.com/docs/glossary/what-e164) phone number of the
	// user (required for SMS channels).
	PhoneNumber param.Field[string] `json:"phone_number"`
	// Inline set preferences for a recipient, where the key is the preference set id.
	// Preferences that are set inline will be merged into any existing preferences
	// rather than replacing them.
	Preferences param.Field[InlinePreferenceSetRequestParam] `json:"preferences"`
	// The timezone of the user. Must be a
	// valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
	// Used
	// for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
	Timezone    param.Field[string]    `json:"timezone"`
	ExtraFields map[string]interface{} `json:"-,extras"`
}

A set of parameters to inline-identify a user with. Inline identifying the user will ensure that the user is available before the request is executed in Knock. It will perform an upsert for the user you're supplying, replacing any properties specified.

func (InlineIdentifyUserRequestParam) ImplementsRecipientRequestUnionParam

func (r InlineIdentifyUserRequestParam) ImplementsRecipientRequestUnionParam()

func (InlineIdentifyUserRequestParam) MarshalJSON

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

type InlineObjectRequestParam

type InlineObjectRequestParam struct {
	// Unique identifier for the object.
	ID param.Field[string] `json:"id,required"`
	// The collection this object belongs to.
	Collection param.Field[string] `json:"collection,required"`
	// A request to set channel data for a type of channel inline.
	ChannelData param.Field[InlineChannelDataRequestParam] `json:"channel_data"`
	// Timestamp when the resource was created.
	CreatedAt param.Field[time.Time] `json:"created_at" format:"date-time"`
	// Inline set preferences for a recipient, where the key is the preference set id.
	// Preferences that are set inline will be merged into any existing preferences
	// rather than replacing them.
	Preferences param.Field[InlinePreferenceSetRequestParam] `json:"preferences"`
	ExtraFields map[string]interface{}                       `json:"-,extras"`
}

A custom Object(/concepts/objects) entity which belongs to a collection.

func (InlineObjectRequestParam) ImplementsRecipientRequestUnionParam

func (r InlineObjectRequestParam) ImplementsRecipientRequestUnionParam()

func (InlineObjectRequestParam) MarshalJSON

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

type InlinePreferenceSetRequestParam

type InlinePreferenceSetRequestParam map[string]PreferenceSetRequestParam

type InlineTenantRequestUnionParam

type InlineTenantRequestUnionParam interface {
	ImplementsInlineTenantRequestUnionParam()
}

An request to set a tenant inline.

Satisfied by shared.UnionString, TenantRequestParam.

type IntegrationCensusCustomDestinationParams

type IntegrationCensusCustomDestinationParams struct {
	// The unique identifier for the RPC request.
	ID param.Field[string] `json:"id,required"`
	// The JSON-RPC version.
	Jsonrpc param.Field[string] `json:"jsonrpc,required"`
	// The method name to execute.
	Method param.Field[string] `json:"method,required"`
	// The parameters for the method.
	Params param.Field[map[string]interface{}] `json:"params"`
}

func (IntegrationCensusCustomDestinationParams) MarshalJSON

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

type IntegrationCensusCustomDestinationResponse

type IntegrationCensusCustomDestinationResponse struct {
	// The request ID.
	ID string `json:"id"`
	// The result of the RPC call.
	Result map[string]interface{}                         `json:"result"`
	JSON   integrationCensusCustomDestinationResponseJSON `json:"-"`
}

func (*IntegrationCensusCustomDestinationResponse) UnmarshalJSON

func (r *IntegrationCensusCustomDestinationResponse) UnmarshalJSON(data []byte) (err error)

type IntegrationCensusService

type IntegrationCensusService struct {
	Options []option.RequestOption
}

IntegrationCensusService contains methods and other services that help with interacting with the knock 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 NewIntegrationCensusService method instead.

func NewIntegrationCensusService

func NewIntegrationCensusService(opts ...option.RequestOption) (r *IntegrationCensusService)

NewIntegrationCensusService 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 (*IntegrationCensusService) CustomDestination

Processes a Census custom destination RPC request.

type IntegrationHightouchEmbeddedDestinationParams

type IntegrationHightouchEmbeddedDestinationParams struct {
	// The unique identifier for the RPC request.
	ID param.Field[string] `json:"id,required"`
	// The JSON-RPC version.
	Jsonrpc param.Field[string] `json:"jsonrpc,required"`
	// The method name to execute.
	Method param.Field[string] `json:"method,required"`
	// The parameters for the method.
	Params param.Field[map[string]interface{}] `json:"params"`
}

func (IntegrationHightouchEmbeddedDestinationParams) MarshalJSON

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

type IntegrationHightouchEmbeddedDestinationResponse

type IntegrationHightouchEmbeddedDestinationResponse struct {
	// The request ID.
	ID string `json:"id"`
	// The result of the RPC call.
	Result map[string]interface{}                              `json:"result"`
	JSON   integrationHightouchEmbeddedDestinationResponseJSON `json:"-"`
}

func (*IntegrationHightouchEmbeddedDestinationResponse) UnmarshalJSON

func (r *IntegrationHightouchEmbeddedDestinationResponse) UnmarshalJSON(data []byte) (err error)

type IntegrationHightouchService

type IntegrationHightouchService struct {
	Options []option.RequestOption
}

IntegrationHightouchService contains methods and other services that help with interacting with the knock 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 NewIntegrationHightouchService method instead.

func NewIntegrationHightouchService

func NewIntegrationHightouchService(opts ...option.RequestOption) (r *IntegrationHightouchService)

NewIntegrationHightouchService 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 (*IntegrationHightouchService) EmbeddedDestination

Processes a Hightouch embedded destination RPC request.

type IntegrationService

type IntegrationService struct {
	Options   []option.RequestOption
	Census    *IntegrationCensusService
	Hightouch *IntegrationHightouchService
}

IntegrationService contains methods and other services that help with interacting with the knock 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 NewIntegrationService method instead.

func NewIntegrationService

func NewIntegrationService(opts ...option.RequestOption) (r *IntegrationService)

NewIntegrationService 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 Message

type Message struct {
	// The unique identifier for the message.
	ID string `json:"id,required"`
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The ID for the channel the message was sent through.
	ChannelID string `json:"channel_id,required" format:"uuid"`
	// A list of engagement statuses.
	EngagementStatuses []MessageEngagementStatus `json:"engagement_statuses,required"`
	// Timestamp when the resource was created.
	InsertedAt time.Time `json:"inserted_at,required" format:"date-time"`
	// A reference to a recipient, either a user identifier (string) or an object
	// reference (ID, collection).
	Recipient RecipientReferenceUnion `json:"recipient,required"`
	// The workflow that triggered the message.
	Source MessageSource `json:"source,required"`
	// The message delivery status.
	Status MessageStatus `json:"status,required"`
	// The timestamp when the resource was last updated.
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// One or more actors that are associated with this message. Note: this is a list
	// that can contain up to 10 actors if the message is produced from a
	// [batch](/designing-workflows/batch-function).
	Actors []RecipientReferenceUnion `json:"actors"`
	// Timestamp when the message was archived.
	ArchivedAt time.Time `json:"archived_at,nullable" format:"date-time"`
	// Timestamp when the message was clicked.
	ClickedAt time.Time `json:"clicked_at,nullable" format:"date-time"`
	// Data associated with the message’s workflow run. Includes the workflow trigger
	// request’s `data` payload merged with any additional data returned by a
	// [fetch function](/designing-workflows/fetch-function). For messages produced
	// after a [batch step](/designing-workflows/batch-function), includes the payload
	// `data` from the most-recent trigger request (the final `activity` in the batch).
	Data map[string]interface{} `json:"data,nullable"`
	// Timestamp when the message was interacted with.
	InteractedAt time.Time `json:"interacted_at,nullable" format:"date-time"`
	// Timestamp when a link in the message was clicked.
	LinkClickedAt time.Time `json:"link_clicked_at,nullable" format:"date-time"`
	// The metadata associated with the message.
	Metadata map[string]interface{} `json:"metadata,nullable"`
	// Timestamp when the message was read.
	ReadAt time.Time `json:"read_at,nullable" format:"date-time"`
	// Timestamp when the message was scheduled to be sent.
	ScheduledAt time.Time `json:"scheduled_at,nullable" format:"date-time"`
	// Timestamp when the message was seen.
	SeenAt time.Time `json:"seen_at,nullable" format:"date-time"`
	// The ID of the `tenant` associated with the message. Only present when a `tenant`
	// is provided on a workflow trigger request.
	Tenant string `json:"tenant,nullable"`
	// The key of the workflow that generated the message.
	//
	// Deprecated: deprecated
	Workflow string      `json:"workflow,nullable"`
	JSON     messageJSON `json:"-"`
}

Represents a single message that was generated by a workflow for a given channel.

func (*Message) UnmarshalJSON

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

type MessageBatchArchiveParams

type MessageBatchArchiveParams struct {
	// The message IDs to update the status of.
	MessageIDs param.Field[[]string] `json:"message_ids,required"`
}

func (MessageBatchArchiveParams) MarshalJSON

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

type MessageBatchGetContentParams

type MessageBatchGetContentParams struct {
	// The IDs of the messages to fetch contents of.
	MessageIDs param.Field[[]string] `query:"message_ids,required"`
}

func (MessageBatchGetContentParams) URLQuery

func (r MessageBatchGetContentParams) URLQuery() (v url.Values)

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

type MessageBatchGetContentResponse

type MessageBatchGetContentResponse struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// Content data specific to the channel type.
	Data MessageBatchGetContentResponseData `json:"data,required"`
	// Timestamp when the message content was created.
	InsertedAt time.Time `json:"inserted_at,required" format:"date-time"`
	// The unique identifier for the message content.
	MessageID string                             `json:"message_id,required"`
	JSON      messageBatchGetContentResponseJSON `json:"-"`
}

The content of a message.

func (*MessageBatchGetContentResponse) UnmarshalJSON

func (r *MessageBatchGetContentResponse) UnmarshalJSON(data []byte) (err error)

type MessageBatchGetContentResponseData

type MessageBatchGetContentResponseData struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The device token to send the push notification to.
	Token string `json:"token"`
	// The BCC email addresses.
	Bcc string `json:"bcc,nullable"`
	// This field can have the runtime type of
	// [[]MessageBatchGetContentResponseDataMessageInAppFeedContentBlock].
	Blocks interface{} `json:"blocks"`
	// The content body of the SMS message.
	Body string `json:"body"`
	// The CC email addresses.
	Cc string `json:"cc,nullable"`
	// This field can have the runtime type of [map[string]interface{}].
	Connection interface{} `json:"connection"`
	// This field can have the runtime type of [map[string]interface{}].
	Data interface{} `json:"data"`
	// The sender's email address.
	From string `json:"from"`
	// The HTML body of the email message.
	HTMLBody string `json:"html_body"`
	// This field can have the runtime type of [map[string]interface{}].
	Metadata interface{} `json:"metadata"`
	// The reply-to email address.
	ReplyTo string `json:"reply_to,nullable"`
	// The subject line of the email message.
	SubjectLine string `json:"subject_line"`
	// This field can have the runtime type of
	// [MessageBatchGetContentResponseDataMessageChatContentTemplate].
	Template interface{} `json:"template"`
	// The text body of the email message.
	TextBody string `json:"text_body"`
	// The title of the push notification.
	Title string `json:"title"`
	// The recipient's email address.
	To   string                                 `json:"to"`
	JSON messageBatchGetContentResponseDataJSON `json:"-"`
	// contains filtered or unexported fields
}

Content data specific to the channel type.

func (*MessageBatchGetContentResponseData) UnmarshalJSON

func (r *MessageBatchGetContentResponseData) UnmarshalJSON(data []byte) (err error)

type MessageBatchGetContentResponseDataMessageChatContent

type MessageBatchGetContentResponseDataMessageChatContent struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The channel data connection from the recipient to the underlying provider.
	Connection map[string]interface{} `json:"connection,required"`
	// The template structure for the chat message.
	Template MessageBatchGetContentResponseDataMessageChatContentTemplate `json:"template,required"`
	// Additional metadata associated with the chat message.
	Metadata map[string]interface{}                                   `json:"metadata,nullable"`
	JSON     messageBatchGetContentResponseDataMessageChatContentJSON `json:"-"`
}

The content of a chat message.

func (*MessageBatchGetContentResponseDataMessageChatContent) UnmarshalJSON

func (r *MessageBatchGetContentResponseDataMessageChatContent) UnmarshalJSON(data []byte) (err error)

type MessageBatchGetContentResponseDataMessageChatContentTemplate

type MessageBatchGetContentResponseDataMessageChatContentTemplate struct {
	// The blocks of the message in a chat.
	Blocks []MessageBatchGetContentResponseDataMessageChatContentTemplateBlock `json:"blocks,nullable"`
	// The JSON content of the message.
	JsonContent map[string]interface{} `json:"json_content,nullable"`
	// The summary of the chat message.
	Summary string                                                           `json:"summary,nullable"`
	JSON    messageBatchGetContentResponseDataMessageChatContentTemplateJSON `json:"-"`
}

The template structure for the chat message.

func (*MessageBatchGetContentResponseDataMessageChatContentTemplate) UnmarshalJSON

type MessageBatchGetContentResponseDataMessageChatContentTemplateBlock

type MessageBatchGetContentResponseDataMessageChatContentTemplateBlock struct {
	// The actual content of the block.
	Content string `json:"content,required"`
	// The name of the block for identification.
	Name string `json:"name,required"`
	// The type of block in a message in a chat (text or markdown).
	Type MessageBatchGetContentResponseDataMessageChatContentTemplateBlocksType `json:"type,required"`
	JSON messageBatchGetContentResponseDataMessageChatContentTemplateBlockJSON  `json:"-"`
}

A block in a message in a chat.

func (*MessageBatchGetContentResponseDataMessageChatContentTemplateBlock) UnmarshalJSON

type MessageBatchGetContentResponseDataMessageChatContentTemplateBlocksType

type MessageBatchGetContentResponseDataMessageChatContentTemplateBlocksType string

The type of block in a message in a chat (text or markdown).

const (
	MessageBatchGetContentResponseDataMessageChatContentTemplateBlocksTypeText     MessageBatchGetContentResponseDataMessageChatContentTemplateBlocksType = "text"
	MessageBatchGetContentResponseDataMessageChatContentTemplateBlocksTypeMarkdown MessageBatchGetContentResponseDataMessageChatContentTemplateBlocksType = "markdown"
)

func (MessageBatchGetContentResponseDataMessageChatContentTemplateBlocksType) IsKnown

type MessageBatchGetContentResponseDataMessageEmailContent

type MessageBatchGetContentResponseDataMessageEmailContent struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The sender's email address.
	From string `json:"from,required"`
	// The HTML body of the email message.
	HTMLBody string `json:"html_body,required"`
	// The subject line of the email message.
	SubjectLine string `json:"subject_line,required"`
	// The text body of the email message.
	TextBody string `json:"text_body,required"`
	// The recipient's email address.
	To string `json:"to,required"`
	// The BCC email addresses.
	Bcc string `json:"bcc,nullable"`
	// The CC email addresses.
	Cc string `json:"cc,nullable"`
	// The reply-to email address.
	ReplyTo string                                                    `json:"reply_to,nullable"`
	JSON    messageBatchGetContentResponseDataMessageEmailContentJSON `json:"-"`
}

The content of an email message.

func (*MessageBatchGetContentResponseDataMessageEmailContent) UnmarshalJSON

func (r *MessageBatchGetContentResponseDataMessageEmailContent) UnmarshalJSON(data []byte) (err error)

type MessageBatchGetContentResponseDataMessageInAppFeedContent

type MessageBatchGetContentResponseDataMessageInAppFeedContent struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The blocks of the message in an app feed.
	Blocks []MessageBatchGetContentResponseDataMessageInAppFeedContentBlock `json:"blocks,required"`
	JSON   messageBatchGetContentResponseDataMessageInAppFeedContentJSON    `json:"-"`
}

The content of an in-app feed message.

func (*MessageBatchGetContentResponseDataMessageInAppFeedContent) UnmarshalJSON

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlock

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlock struct {
	// The name of the block in a message in an app feed.
	Name string `json:"name,required"`
	// The type of block in a message in an app feed.
	Type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksType `json:"type,required"`
	// This field can have the runtime type of
	// [[]MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockButton].
	Buttons interface{} `json:"buttons"`
	// The content of the block in a message in an app feed.
	Content string `json:"content"`
	// The rendered HTML version of the content.
	Rendered string                                                             `json:"rendered"`
	JSON     messageBatchGetContentResponseDataMessageInAppFeedContentBlockJSON `json:"-"`
	// contains filtered or unexported fields
}

A block in a message in an app feed.

func (*MessageBatchGetContentResponseDataMessageInAppFeedContentBlock) UnmarshalJSON

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlock

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlock struct {
	// A list of buttons in an in app feed message.
	Buttons []MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockButton `json:"buttons,required"`
	// The name of the button set in a message in an app feed.
	Name string `json:"name,required"`
	// The type of block in a message in an app feed.
	Type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockType `json:"type,required"`
	JSON messageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockJSON `json:"-"`
}

A button set block in a message in an app feed.

func (*MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlock) UnmarshalJSON

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockButton

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockButton struct {
	// The action to take when the button is clicked.
	Action string `json:"action,required"`
	// The label of the button.
	Label string `json:"label,required"`
	// The name of the button.
	Name string                                                                                                  `json:"name,required"`
	JSON messageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockButtonJSON `json:"-"`
}

A button in an in app feed message.

func (*MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockButton) UnmarshalJSON

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockType

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockType string

The type of block in a message in an app feed.

const (
	MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockTypeButtonSet MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockType = "button_set"
)

func (MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockType) IsKnown

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlock

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlock struct {
	// The content of the block in a message in an app feed.
	Content string `json:"content,required"`
	// The name of the block in a message in an app feed.
	Name string `json:"name,required"`
	// The rendered HTML version of the content.
	Rendered string `json:"rendered,required"`
	// The type of block in a message in an app feed.
	Type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockType `json:"type,required"`
	JSON messageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockJSON `json:"-"`
}

A block in a message in an app feed.

func (*MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlock) UnmarshalJSON

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockType

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockType string

The type of block in a message in an app feed.

const (
	MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockTypeMarkdown MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockType = "markdown"
	MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockTypeText     MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockType = "text"
)

func (MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockType) IsKnown

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksType

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksType string

The type of block in a message in an app feed.

const (
	MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksTypeMarkdown  MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksType = "markdown"
	MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksTypeText      MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksType = "text"
	MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksTypeButtonSet MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksType = "button_set"
)

func (MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksType) IsKnown

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksUnion

type MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksUnion interface {
	// contains filtered or unexported methods
}

A block in a message in an app feed.

Union satisfied by MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlock or MessageBatchGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlock.

type MessageBatchGetContentResponseDataMessagePushContent

type MessageBatchGetContentResponseDataMessagePushContent struct {
	// The device token to send the push notification to.
	Token string `json:"token,required"`
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The content body of the push notification.
	Body string `json:"body,required"`
	// The title of the push notification.
	Title string `json:"title,required"`
	// Additional data payload for the push notification.
	Data map[string]interface{}                                   `json:"data,nullable"`
	JSON messageBatchGetContentResponseDataMessagePushContentJSON `json:"-"`
}

Push channel data.

func (*MessageBatchGetContentResponseDataMessagePushContent) UnmarshalJSON

func (r *MessageBatchGetContentResponseDataMessagePushContent) UnmarshalJSON(data []byte) (err error)

type MessageBatchGetContentResponseDataMessageSMSContent

type MessageBatchGetContentResponseDataMessageSMSContent struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The content body of the SMS message.
	Body string `json:"body,required"`
	// The phone number the SMS was sent to.
	To   string                                                  `json:"to,required"`
	JSON messageBatchGetContentResponseDataMessageSMSContentJSON `json:"-"`
}

The content of an SMS message.

func (*MessageBatchGetContentResponseDataMessageSMSContent) UnmarshalJSON

func (r *MessageBatchGetContentResponseDataMessageSMSContent) UnmarshalJSON(data []byte) (err error)

type MessageBatchMarkAsInteractedParams

type MessageBatchMarkAsInteractedParams struct {
	// The message IDs to batch mark as interacted with.
	MessageIDs param.Field[[]string] `json:"message_ids,required"`
	// Metadata about the interaction.
	Metadata param.Field[map[string]interface{}] `json:"metadata"`
}

func (MessageBatchMarkAsInteractedParams) MarshalJSON

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

type MessageBatchMarkAsReadParams

type MessageBatchMarkAsReadParams struct {
	// The message IDs to update the status of.
	MessageIDs param.Field[[]string] `json:"message_ids,required"`
}

func (MessageBatchMarkAsReadParams) MarshalJSON

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

type MessageBatchMarkAsSeenParams

type MessageBatchMarkAsSeenParams struct {
	// The message IDs to update the status of.
	MessageIDs param.Field[[]string] `json:"message_ids,required"`
}

func (MessageBatchMarkAsSeenParams) MarshalJSON

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

type MessageBatchMarkAsUnreadParams

type MessageBatchMarkAsUnreadParams struct {
	// The message IDs to update the status of.
	MessageIDs param.Field[[]string] `json:"message_ids,required"`
}

func (MessageBatchMarkAsUnreadParams) MarshalJSON

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

type MessageBatchMarkAsUnseenParams

type MessageBatchMarkAsUnseenParams struct {
	// The message IDs to update the status of.
	MessageIDs param.Field[[]string] `json:"message_ids,required"`
}

func (MessageBatchMarkAsUnseenParams) MarshalJSON

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

type MessageBatchService

type MessageBatchService struct {
	Options []option.RequestOption
}

MessageBatchService contains methods and other services that help with interacting with the knock 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 NewMessageBatchService method instead.

func NewMessageBatchService

func NewMessageBatchService(opts ...option.RequestOption) (r *MessageBatchService)

NewMessageBatchService 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 (*MessageBatchService) Archive

func (r *MessageBatchService) Archive(ctx context.Context, body MessageBatchArchiveParams, opts ...option.RequestOption) (res *[]Message, err error)

Marks the given messages as archived. Archived messages are hidden from the default message list in the feed but can still be accessed and unarchived later.

func (*MessageBatchService) GetContent

Get the contents of multiple messages in a single request.

func (*MessageBatchService) MarkAsInteracted

func (r *MessageBatchService) MarkAsInteracted(ctx context.Context, body MessageBatchMarkAsInteractedParams, opts ...option.RequestOption) (res *[]Message, err error)

Marks the given messages as interacted with by the user. This can include any user action on the message, with optional metadata about the specific interaction. Cannot include more than 5 key-value pairs, must not contain nested data. Read more about message engagement statuses [here](/send-notifications/message-statuses#engagement-status).

func (*MessageBatchService) MarkAsRead

func (r *MessageBatchService) MarkAsRead(ctx context.Context, body MessageBatchMarkAsReadParams, opts ...option.RequestOption) (res *[]Message, err error)

Marks the given messages as `read`. Read more about message engagement statuses [here](/send-notifications/message-statuses#engagement-status).

func (*MessageBatchService) MarkAsSeen

func (r *MessageBatchService) MarkAsSeen(ctx context.Context, body MessageBatchMarkAsSeenParams, opts ...option.RequestOption) (res *[]Message, err error)

Marks the given messages as `seen`. This indicates that the user has viewed the message in their feed or inbox. Read more about message engagement statuses [here](/send-notifications/message-statuses#engagement-status).

func (*MessageBatchService) MarkAsUnread

func (r *MessageBatchService) MarkAsUnread(ctx context.Context, body MessageBatchMarkAsUnreadParams, opts ...option.RequestOption) (res *[]Message, err error)

Marks the given messages as `unread`. This reverses the `read` state. Read more about message engagement statuses [here](/send-notifications/message-statuses#engagement-status).

func (*MessageBatchService) MarkAsUnseen

func (r *MessageBatchService) MarkAsUnseen(ctx context.Context, body MessageBatchMarkAsUnseenParams, opts ...option.RequestOption) (res *[]Message, err error)

Marks the given messages as `unseen`. This reverses the `seen` state. Read more about message engagement statuses [here](/send-notifications/message-statuses#engagement-status).

func (*MessageBatchService) Unarchive

func (r *MessageBatchService) Unarchive(ctx context.Context, body MessageBatchUnarchiveParams, opts ...option.RequestOption) (res *[]Message, err error)

Marks the given messages as unarchived. This reverses the `archived` state. Archived messages are hidden from the default message list in the feed but can still be accessed and unarchived later.

type MessageBatchUnarchiveParams

type MessageBatchUnarchiveParams struct {
	// The message IDs to update the status of.
	MessageIDs param.Field[[]string] `json:"message_ids,required"`
}

func (MessageBatchUnarchiveParams) MarshalJSON

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

type MessageDeliveryLog

type MessageDeliveryLog struct {
	// The unique identifier for the message delivery log.
	ID string `json:"id,required"`
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The ID of the environment in which the message delivery occurred.
	EnvironmentID string `json:"environment_id,required" format:"uuid"`
	// Timestamp when the message delivery log was created.
	InsertedAt string `json:"inserted_at,required"`
	// A message delivery log request.
	Request MessageDeliveryLogRequest `json:"request,required"`
	// A message delivery log response.
	Response MessageDeliveryLogResponse `json:"response,required"`
	// The name of the service that processed the delivery.
	ServiceName string                 `json:"service_name,required"`
	JSON        messageDeliveryLogJSON `json:"-"`
}

A message delivery log contains a `request` from Knock to a downstream provider and the `response` that was returned.

func (*MessageDeliveryLog) UnmarshalJSON

func (r *MessageDeliveryLog) UnmarshalJSON(data []byte) (err error)

type MessageDeliveryLogRequest

type MessageDeliveryLogRequest struct {
	// The body content that was sent with the request.
	Body MessageDeliveryLogRequestBodyUnion `json:"body"`
	// The headers that were sent with the request.
	Headers map[string]interface{} `json:"headers,nullable"`
	// The host to which the request was sent.
	Host string `json:"host"`
	// The HTTP method used for the request.
	Method MessageDeliveryLogRequestMethod `json:"method"`
	// The path of the URL that was requested.
	Path string `json:"path"`
	// The query string of the URL that was requested.
	Query string                        `json:"query,nullable"`
	JSON  messageDeliveryLogRequestJSON `json:"-"`
}

A message delivery log request.

func (*MessageDeliveryLogRequest) UnmarshalJSON

func (r *MessageDeliveryLogRequest) UnmarshalJSON(data []byte) (err error)

type MessageDeliveryLogRequestBodyMap

type MessageDeliveryLogRequestBodyMap map[string]interface{}

func (MessageDeliveryLogRequestBodyMap) ImplementsMessageDeliveryLogRequestBodyUnion

func (r MessageDeliveryLogRequestBodyMap) ImplementsMessageDeliveryLogRequestBodyUnion()

type MessageDeliveryLogRequestBodyUnion

type MessageDeliveryLogRequestBodyUnion interface {
	ImplementsMessageDeliveryLogRequestBodyUnion()
}

The body content that was sent with the request.

Union satisfied by shared.UnionString or MessageDeliveryLogRequestBodyMap.

type MessageDeliveryLogRequestMethod

type MessageDeliveryLogRequestMethod string

The HTTP method used for the request.

const (
	MessageDeliveryLogRequestMethodGet    MessageDeliveryLogRequestMethod = "GET"
	MessageDeliveryLogRequestMethodPost   MessageDeliveryLogRequestMethod = "POST"
	MessageDeliveryLogRequestMethodPut    MessageDeliveryLogRequestMethod = "PUT"
	MessageDeliveryLogRequestMethodDelete MessageDeliveryLogRequestMethod = "DELETE"
	MessageDeliveryLogRequestMethodPatch  MessageDeliveryLogRequestMethod = "PATCH"
)

func (MessageDeliveryLogRequestMethod) IsKnown

type MessageDeliveryLogResponse

type MessageDeliveryLogResponse struct {
	// The body content that was received with the response.
	Body MessageDeliveryLogResponseBodyUnion `json:"body"`
	// The headers that were received with the response.
	Headers map[string]interface{} `json:"headers,nullable"`
	// The HTTP status code of the response.
	Status int64                          `json:"status"`
	JSON   messageDeliveryLogResponseJSON `json:"-"`
}

A message delivery log response.

func (*MessageDeliveryLogResponse) UnmarshalJSON

func (r *MessageDeliveryLogResponse) UnmarshalJSON(data []byte) (err error)

type MessageDeliveryLogResponseBodyMap

type MessageDeliveryLogResponseBodyMap map[string]interface{}

func (MessageDeliveryLogResponseBodyMap) ImplementsMessageDeliveryLogResponseBodyUnion

func (r MessageDeliveryLogResponseBodyMap) ImplementsMessageDeliveryLogResponseBodyUnion()

type MessageDeliveryLogResponseBodyUnion

type MessageDeliveryLogResponseBodyUnion interface {
	ImplementsMessageDeliveryLogResponseBodyUnion()
}

The body content that was received with the response.

Union satisfied by shared.UnionString or MessageDeliveryLogResponseBodyMap.

type MessageEngagementStatus

type MessageEngagementStatus string

An engagement status for a message. Can be one of: read, seen, interacted, link_clicked, archived.

const (
	MessageEngagementStatusSeen        MessageEngagementStatus = "seen"
	MessageEngagementStatusRead        MessageEngagementStatus = "read"
	MessageEngagementStatusInteracted  MessageEngagementStatus = "interacted"
	MessageEngagementStatusLinkClicked MessageEngagementStatus = "link_clicked"
	MessageEngagementStatusArchived    MessageEngagementStatus = "archived"
)

func (MessageEngagementStatus) IsKnown

func (r MessageEngagementStatus) IsKnown() bool

type MessageEvent

type MessageEvent struct {
	// The unique identifier for the message event.
	ID string `json:"id,required"`
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// Timestamp when the event was created.
	InsertedAt time.Time `json:"inserted_at,required" format:"date-time"`
	// A reference to a recipient, either a user identifier (string) or an object
	// reference (ID, collection).
	Recipient RecipientReferenceUnion `json:"recipient,required"`
	// The type of event that occurred.
	Type MessageEventType `json:"type,required"`
	// The data associated with the message event. Only present for some event types.
	Data map[string]interface{} `json:"data,nullable"`
	JSON messageEventJSON       `json:"-"`
}

A message event. Occurs when a message [delivery or engagement status](/send-notifications/message-statuses) changes.

func (*MessageEvent) UnmarshalJSON

func (r *MessageEvent) UnmarshalJSON(data []byte) (err error)

type MessageEventType

type MessageEventType string

The type of event that occurred.

const (
	MessageEventTypeMessageArchived          MessageEventType = "message.archived"
	MessageEventTypeMessageBounced           MessageEventType = "message.bounced"
	MessageEventTypeMessageDelivered         MessageEventType = "message.delivered"
	MessageEventTypeMessageDeliveryAttempted MessageEventType = "message.delivery_attempted"
	MessageEventTypeMessageInteracted        MessageEventType = "message.interacted"
	MessageEventTypeMessageLinkClicked       MessageEventType = "message.link_clicked"
	MessageEventTypeMessageNotSent           MessageEventType = "message.not_sent"
	MessageEventTypeMessageQueued            MessageEventType = "message.queued"
	MessageEventTypeMessageRead              MessageEventType = "message.read"
	MessageEventTypeMessageSeen              MessageEventType = "message.seen"
	MessageEventTypeMessageSent              MessageEventType = "message.sent"
	MessageEventTypeMessageUnarchived        MessageEventType = "message.unarchived"
	MessageEventTypeMessageUndelivered       MessageEventType = "message.undelivered"
	MessageEventTypeMessageUnread            MessageEventType = "message.unread"
	MessageEventTypeMessageUnseen            MessageEventType = "message.unseen"
)

func (MessageEventType) IsKnown

func (r MessageEventType) IsKnown() bool

type MessageGetContentResponse

type MessageGetContentResponse struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// Content data specific to the channel type.
	Data MessageGetContentResponseData `json:"data,required"`
	// Timestamp when the message content was created.
	InsertedAt time.Time `json:"inserted_at,required" format:"date-time"`
	// The unique identifier for the message content.
	MessageID string                        `json:"message_id,required"`
	JSON      messageGetContentResponseJSON `json:"-"`
}

The content of a message.

func (*MessageGetContentResponse) UnmarshalJSON

func (r *MessageGetContentResponse) UnmarshalJSON(data []byte) (err error)

type MessageGetContentResponseData

type MessageGetContentResponseData struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The device token to send the push notification to.
	Token string `json:"token"`
	// The BCC email addresses.
	Bcc string `json:"bcc,nullable"`
	// This field can have the runtime type of
	// [[]MessageGetContentResponseDataMessageInAppFeedContentBlock].
	Blocks interface{} `json:"blocks"`
	// The content body of the SMS message.
	Body string `json:"body"`
	// The CC email addresses.
	Cc string `json:"cc,nullable"`
	// This field can have the runtime type of [map[string]interface{}].
	Connection interface{} `json:"connection"`
	// This field can have the runtime type of [map[string]interface{}].
	Data interface{} `json:"data"`
	// The sender's email address.
	From string `json:"from"`
	// The HTML body of the email message.
	HTMLBody string `json:"html_body"`
	// This field can have the runtime type of [map[string]interface{}].
	Metadata interface{} `json:"metadata"`
	// The reply-to email address.
	ReplyTo string `json:"reply_to,nullable"`
	// The subject line of the email message.
	SubjectLine string `json:"subject_line"`
	// This field can have the runtime type of
	// [MessageGetContentResponseDataMessageChatContentTemplate].
	Template interface{} `json:"template"`
	// The text body of the email message.
	TextBody string `json:"text_body"`
	// The title of the push notification.
	Title string `json:"title"`
	// The recipient's email address.
	To   string                            `json:"to"`
	JSON messageGetContentResponseDataJSON `json:"-"`
	// contains filtered or unexported fields
}

Content data specific to the channel type.

func (*MessageGetContentResponseData) UnmarshalJSON

func (r *MessageGetContentResponseData) UnmarshalJSON(data []byte) (err error)

type MessageGetContentResponseDataMessageChatContent

type MessageGetContentResponseDataMessageChatContent struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The channel data connection from the recipient to the underlying provider.
	Connection map[string]interface{} `json:"connection,required"`
	// The template structure for the chat message.
	Template MessageGetContentResponseDataMessageChatContentTemplate `json:"template,required"`
	// Additional metadata associated with the chat message.
	Metadata map[string]interface{}                              `json:"metadata,nullable"`
	JSON     messageGetContentResponseDataMessageChatContentJSON `json:"-"`
}

The content of a chat message.

func (*MessageGetContentResponseDataMessageChatContent) UnmarshalJSON

func (r *MessageGetContentResponseDataMessageChatContent) UnmarshalJSON(data []byte) (err error)

type MessageGetContentResponseDataMessageChatContentTemplate

type MessageGetContentResponseDataMessageChatContentTemplate struct {
	// The blocks of the message in a chat.
	Blocks []MessageGetContentResponseDataMessageChatContentTemplateBlock `json:"blocks,nullable"`
	// The JSON content of the message.
	JsonContent map[string]interface{} `json:"json_content,nullable"`
	// The summary of the chat message.
	Summary string                                                      `json:"summary,nullable"`
	JSON    messageGetContentResponseDataMessageChatContentTemplateJSON `json:"-"`
}

The template structure for the chat message.

func (*MessageGetContentResponseDataMessageChatContentTemplate) UnmarshalJSON

type MessageGetContentResponseDataMessageChatContentTemplateBlock

type MessageGetContentResponseDataMessageChatContentTemplateBlock struct {
	// The actual content of the block.
	Content string `json:"content,required"`
	// The name of the block for identification.
	Name string `json:"name,required"`
	// The type of block in a message in a chat (text or markdown).
	Type MessageGetContentResponseDataMessageChatContentTemplateBlocksType `json:"type,required"`
	JSON messageGetContentResponseDataMessageChatContentTemplateBlockJSON  `json:"-"`
}

A block in a message in a chat.

func (*MessageGetContentResponseDataMessageChatContentTemplateBlock) UnmarshalJSON

type MessageGetContentResponseDataMessageChatContentTemplateBlocksType

type MessageGetContentResponseDataMessageChatContentTemplateBlocksType string

The type of block in a message in a chat (text or markdown).

const (
	MessageGetContentResponseDataMessageChatContentTemplateBlocksTypeText     MessageGetContentResponseDataMessageChatContentTemplateBlocksType = "text"
	MessageGetContentResponseDataMessageChatContentTemplateBlocksTypeMarkdown MessageGetContentResponseDataMessageChatContentTemplateBlocksType = "markdown"
)

func (MessageGetContentResponseDataMessageChatContentTemplateBlocksType) IsKnown

type MessageGetContentResponseDataMessageEmailContent

type MessageGetContentResponseDataMessageEmailContent struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The sender's email address.
	From string `json:"from,required"`
	// The HTML body of the email message.
	HTMLBody string `json:"html_body,required"`
	// The subject line of the email message.
	SubjectLine string `json:"subject_line,required"`
	// The text body of the email message.
	TextBody string `json:"text_body,required"`
	// The recipient's email address.
	To string `json:"to,required"`
	// The BCC email addresses.
	Bcc string `json:"bcc,nullable"`
	// The CC email addresses.
	Cc string `json:"cc,nullable"`
	// The reply-to email address.
	ReplyTo string                                               `json:"reply_to,nullable"`
	JSON    messageGetContentResponseDataMessageEmailContentJSON `json:"-"`
}

The content of an email message.

func (*MessageGetContentResponseDataMessageEmailContent) UnmarshalJSON

func (r *MessageGetContentResponseDataMessageEmailContent) UnmarshalJSON(data []byte) (err error)

type MessageGetContentResponseDataMessageInAppFeedContent

type MessageGetContentResponseDataMessageInAppFeedContent struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The blocks of the message in an app feed.
	Blocks []MessageGetContentResponseDataMessageInAppFeedContentBlock `json:"blocks,required"`
	JSON   messageGetContentResponseDataMessageInAppFeedContentJSON    `json:"-"`
}

The content of an in-app feed message.

func (*MessageGetContentResponseDataMessageInAppFeedContent) UnmarshalJSON

func (r *MessageGetContentResponseDataMessageInAppFeedContent) UnmarshalJSON(data []byte) (err error)

type MessageGetContentResponseDataMessageInAppFeedContentBlock

type MessageGetContentResponseDataMessageInAppFeedContentBlock struct {
	// The name of the block in a message in an app feed.
	Name string `json:"name,required"`
	// The type of block in a message in an app feed.
	Type MessageGetContentResponseDataMessageInAppFeedContentBlocksType `json:"type,required"`
	// This field can have the runtime type of
	// [[]MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockButton].
	Buttons interface{} `json:"buttons"`
	// The content of the block in a message in an app feed.
	Content string `json:"content"`
	// The rendered HTML version of the content.
	Rendered string                                                        `json:"rendered"`
	JSON     messageGetContentResponseDataMessageInAppFeedContentBlockJSON `json:"-"`
	// contains filtered or unexported fields
}

A block in a message in an app feed.

func (*MessageGetContentResponseDataMessageInAppFeedContentBlock) UnmarshalJSON

type MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlock

type MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlock struct {
	// A list of buttons in an in app feed message.
	Buttons []MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockButton `json:"buttons,required"`
	// The name of the button set in a message in an app feed.
	Name string `json:"name,required"`
	// The type of block in a message in an app feed.
	Type MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockType `json:"type,required"`
	JSON messageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockJSON `json:"-"`
}

A button set block in a message in an app feed.

func (*MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlock) UnmarshalJSON

type MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockButton

type MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockButton struct {
	// The action to take when the button is clicked.
	Action string `json:"action,required"`
	// The label of the button.
	Label string `json:"label,required"`
	// The name of the button.
	Name string                                                                                             `json:"name,required"`
	JSON messageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockButtonJSON `json:"-"`
}

A button in an in app feed message.

func (*MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockButton) UnmarshalJSON

type MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockType

type MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockType string

The type of block in a message in an app feed.

const (
	MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockTypeButtonSet MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockType = "button_set"
)

func (MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlockType) IsKnown

type MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlock

type MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlock struct {
	// The content of the block in a message in an app feed.
	Content string `json:"content,required"`
	// The name of the block in a message in an app feed.
	Name string `json:"name,required"`
	// The rendered HTML version of the content.
	Rendered string `json:"rendered,required"`
	// The type of block in a message in an app feed.
	Type MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockType `json:"type,required"`
	JSON messageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockJSON `json:"-"`
}

A block in a message in an app feed.

func (*MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlock) UnmarshalJSON

type MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockType

type MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockType string

The type of block in a message in an app feed.

const (
	MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockTypeMarkdown MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockType = "markdown"
	MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockTypeText     MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockType = "text"
)

func (MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlockType) IsKnown

type MessageGetContentResponseDataMessageInAppFeedContentBlocksType

type MessageGetContentResponseDataMessageInAppFeedContentBlocksType string

The type of block in a message in an app feed.

const (
	MessageGetContentResponseDataMessageInAppFeedContentBlocksTypeMarkdown  MessageGetContentResponseDataMessageInAppFeedContentBlocksType = "markdown"
	MessageGetContentResponseDataMessageInAppFeedContentBlocksTypeText      MessageGetContentResponseDataMessageInAppFeedContentBlocksType = "text"
	MessageGetContentResponseDataMessageInAppFeedContentBlocksTypeButtonSet MessageGetContentResponseDataMessageInAppFeedContentBlocksType = "button_set"
)

func (MessageGetContentResponseDataMessageInAppFeedContentBlocksType) IsKnown

type MessageGetContentResponseDataMessageInAppFeedContentBlocksUnion

type MessageGetContentResponseDataMessageInAppFeedContentBlocksUnion interface {
	// contains filtered or unexported methods
}

A block in a message in an app feed.

Union satisfied by MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedContentBlock or MessageGetContentResponseDataMessageInAppFeedContentBlocksMessageInAppFeedButtonSetBlock.

type MessageGetContentResponseDataMessagePushContent

type MessageGetContentResponseDataMessagePushContent struct {
	// The device token to send the push notification to.
	Token string `json:"token,required"`
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The content body of the push notification.
	Body string `json:"body,required"`
	// The title of the push notification.
	Title string `json:"title,required"`
	// Additional data payload for the push notification.
	Data map[string]interface{}                              `json:"data,nullable"`
	JSON messageGetContentResponseDataMessagePushContentJSON `json:"-"`
}

Push channel data.

func (*MessageGetContentResponseDataMessagePushContent) UnmarshalJSON

func (r *MessageGetContentResponseDataMessagePushContent) UnmarshalJSON(data []byte) (err error)

type MessageGetContentResponseDataMessageSMSContent

type MessageGetContentResponseDataMessageSMSContent struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The content body of the SMS message.
	Body string `json:"body,required"`
	// The phone number the SMS was sent to.
	To   string                                             `json:"to,required"`
	JSON messageGetContentResponseDataMessageSMSContentJSON `json:"-"`
}

The content of an SMS message.

func (*MessageGetContentResponseDataMessageSMSContent) UnmarshalJSON

func (r *MessageGetContentResponseDataMessageSMSContent) UnmarshalJSON(data []byte) (err error)

type MessageListActivitiesParams

type MessageListActivitiesParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
	// The trigger data to filter activities by.
	TriggerData param.Field[string] `query:"trigger_data"`
}

func (MessageListActivitiesParams) URLQuery

func (r MessageListActivitiesParams) URLQuery() (v url.Values)

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

type MessageListDeliveryLogsParams

type MessageListDeliveryLogsParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
}

func (MessageListDeliveryLogsParams) URLQuery

func (r MessageListDeliveryLogsParams) URLQuery() (v url.Values)

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

type MessageListEventsParams

type MessageListEventsParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
}

func (MessageListEventsParams) URLQuery

func (r MessageListEventsParams) URLQuery() (v url.Values)

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

type MessageListParams

type MessageListParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// Limits the results to items with the corresponding channel ID.
	ChannelID param.Field[string] `query:"channel_id"`
	// Limits the results to messages with the given engagement status.
	EngagementStatus param.Field[[]MessageListParamsEngagementStatus] `query:"engagement_status"`
	InsertedAt       param.Field[MessageListParamsInsertedAt]         `query:"inserted_at"`
	// Limits the results to only the message IDs given (max 50). Note: when using this
	// option, the results will be subject to any other filters applied to the query.
	MessageIDs param.Field[[]string] `query:"message_ids"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
	// Limits the results to messages triggered by the given workflow key.
	Source param.Field[string] `query:"source"`
	// Limits the results to messages with the given delivery status.
	Status param.Field[[]MessageListParamsStatus] `query:"status"`
	// Limits the results to items with the corresponding tenant.
	Tenant param.Field[string] `query:"tenant"`
	// Limits the results to only messages that were generated with the given data. See
	// [trigger data filtering](/api-reference/overview/trigger-data-filtering) for
	// more information.
	TriggerData param.Field[string] `query:"trigger_data"`
	// Limits the results to messages related to any of the provided categories.
	WorkflowCategories param.Field[[]string] `query:"workflow_categories"`
	// Limits the results to messages for a specific recipient's workflow run.
	WorkflowRecipientRunID param.Field[string] `query:"workflow_recipient_run_id" format:"uuid"`
	// Limits the results to messages associated with the top-level workflow run ID
	// returned by the workflow trigger request.
	WorkflowRunID param.Field[string] `query:"workflow_run_id" format:"uuid"`
}

func (MessageListParams) URLQuery

func (r MessageListParams) URLQuery() (v url.Values)

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

type MessageListParamsEngagementStatus

type MessageListParamsEngagementStatus string
const (
	MessageListParamsEngagementStatusSeen        MessageListParamsEngagementStatus = "seen"
	MessageListParamsEngagementStatusUnseen      MessageListParamsEngagementStatus = "unseen"
	MessageListParamsEngagementStatusRead        MessageListParamsEngagementStatus = "read"
	MessageListParamsEngagementStatusUnread      MessageListParamsEngagementStatus = "unread"
	MessageListParamsEngagementStatusArchived    MessageListParamsEngagementStatus = "archived"
	MessageListParamsEngagementStatusUnarchived  MessageListParamsEngagementStatus = "unarchived"
	MessageListParamsEngagementStatusLinkClicked MessageListParamsEngagementStatus = "link_clicked"
	MessageListParamsEngagementStatusInteracted  MessageListParamsEngagementStatus = "interacted"
)

func (MessageListParamsEngagementStatus) IsKnown

type MessageListParamsInsertedAt

type MessageListParamsInsertedAt struct {
	// Limits the results to messages inserted after the given date.
	Gt param.Field[string] `query:"gt"`
	// Limits the results to messages inserted after or on the given date.
	Gte param.Field[string] `query:"gte"`
	// Limits the results to messages inserted before the given date.
	Lt param.Field[string] `query:"lt"`
	// Limits the results to messages inserted before or on the given date.
	Lte param.Field[string] `query:"lte"`
}

func (MessageListParamsInsertedAt) URLQuery

func (r MessageListParamsInsertedAt) URLQuery() (v url.Values)

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

type MessageListParamsStatus

type MessageListParamsStatus string
const (
	MessageListParamsStatusQueued            MessageListParamsStatus = "queued"
	MessageListParamsStatusSent              MessageListParamsStatus = "sent"
	MessageListParamsStatusDelivered         MessageListParamsStatus = "delivered"
	MessageListParamsStatusDeliveryAttempted MessageListParamsStatus = "delivery_attempted"
	MessageListParamsStatusUndelivered       MessageListParamsStatus = "undelivered"
	MessageListParamsStatusNotSent           MessageListParamsStatus = "not_sent"
	MessageListParamsStatusBounced           MessageListParamsStatus = "bounced"
)

func (MessageListParamsStatus) IsKnown

func (r MessageListParamsStatus) IsKnown() bool

type MessageMarkAsInteractedParams

type MessageMarkAsInteractedParams struct {
	// Metadata about the interaction.
	Metadata param.Field[map[string]interface{}] `json:"metadata"`
}

func (MessageMarkAsInteractedParams) MarshalJSON

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

type MessageService

type MessageService struct {
	Options []option.RequestOption
	Batch   *MessageBatchService
}

MessageService contains methods and other services that help with interacting with the knock 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 NewMessageService method instead.

func NewMessageService

func NewMessageService(opts ...option.RequestOption) (r *MessageService)

NewMessageService 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 (*MessageService) Archive

func (r *MessageService) Archive(ctx context.Context, messageID string, opts ...option.RequestOption) (res *Message, err error)

Archives a message for the user. Archived messages are hidden from the default message list in the feed but can still be accessed and unarchived later.

func (*MessageService) Get

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

Retrieves a specific message by its ID.

func (*MessageService) GetContent

func (r *MessageService) GetContent(ctx context.Context, messageID string, opts ...option.RequestOption) (res *MessageGetContentResponse, err error)

Returns the fully rendered contents of a message, where the response depends on which channel the message was sent through.

func (*MessageService) List

Returns a paginated list of messages for the current environment.

func (*MessageService) ListActivities

func (r *MessageService) ListActivities(ctx context.Context, messageID string, query MessageListActivitiesParams, opts ...option.RequestOption) (res *pagination.ItemsCursor[Activity], err error)

Returns a paginated list of activities for the specified message.

func (*MessageService) ListActivitiesAutoPaging

func (r *MessageService) ListActivitiesAutoPaging(ctx context.Context, messageID string, query MessageListActivitiesParams, opts ...option.RequestOption) *pagination.ItemsCursorAutoPager[Activity]

Returns a paginated list of activities for the specified message.

func (*MessageService) ListAutoPaging

Returns a paginated list of messages for the current environment.

func (*MessageService) ListDeliveryLogs

func (r *MessageService) ListDeliveryLogs(ctx context.Context, messageID string, query MessageListDeliveryLogsParams, opts ...option.RequestOption) (res *pagination.ItemsCursor[MessageDeliveryLog], err error)

Returns a paginated list of delivery logs for the specified message.

func (*MessageService) ListDeliveryLogsAutoPaging

Returns a paginated list of delivery logs for the specified message.

func (*MessageService) ListEvents

func (r *MessageService) ListEvents(ctx context.Context, messageID string, query MessageListEventsParams, opts ...option.RequestOption) (res *pagination.ItemsCursor[MessageEvent], err error)

Returns a paginated list of events for the specified message.

func (*MessageService) ListEventsAutoPaging

Returns a paginated list of events for the specified message.

func (*MessageService) MarkAsInteracted

func (r *MessageService) MarkAsInteracted(ctx context.Context, messageID string, body MessageMarkAsInteractedParams, opts ...option.RequestOption) (res *Message, err error)

Marks a message as `interacted` with by the user. This can include any user action on the message, with optional metadata about the specific interaction. Cannot include more than 5 key-value pairs, must not contain nested data. Read more about message engagement statuses [here](/send-notifications/message-statuses#engagement-status).

func (*MessageService) MarkAsRead

func (r *MessageService) MarkAsRead(ctx context.Context, messageID string, opts ...option.RequestOption) (res *Message, err error)

Marks a message as `read`. This indicates that the user has read the message content. Read more about message engagement statuses [here](/send-notifications/message-statuses#engagement-status).

func (*MessageService) MarkAsSeen

func (r *MessageService) MarkAsSeen(ctx context.Context, messageID string, opts ...option.RequestOption) (res *Message, err error)

Marks a message as `seen`. This indicates that the user has viewed the message in their feed or inbox. Read more about message engagement statuses [here](/send-notifications/message-statuses#engagement-status).

func (*MessageService) MarkAsUnread

func (r *MessageService) MarkAsUnread(ctx context.Context, messageID string, opts ...option.RequestOption) (res *Message, err error)

Marks a message as `unread`. This reverses the `read` state. Read more about message engagement statuses [here](/send-notifications/message-statuses#engagement-status).

func (*MessageService) MarkAsUnseen

func (r *MessageService) MarkAsUnseen(ctx context.Context, messageID string, opts ...option.RequestOption) (res *Message, err error)

Marks a message as `unseen`. This reverses the `seen` state. Read more about message engagement statuses [here](/send-notifications/message-statuses#engagement-status).

func (*MessageService) Unarchive

func (r *MessageService) Unarchive(ctx context.Context, messageID string, opts ...option.RequestOption) (res *Message, err error)

Removes a message from the archived state, making it visible in the default message list in the feed again.

type MessageSource

type MessageSource struct {
	Typename string `json:"__typename,required"`
	// The categories associated with the message.
	Categories []string `json:"categories,required"`
	// The key of the workflow that triggered the message.
	Key string `json:"key,required"`
	// The ID of the version of the workflow that triggered the message.
	VersionID string `json:"version_id,required" format:"uuid"`
	// The step reference for the step in the workflow that generated the message.
	StepRef string            `json:"step_ref,nullable"`
	JSON    messageSourceJSON `json:"-"`
}

The workflow that triggered the message.

func (*MessageSource) UnmarshalJSON

func (r *MessageSource) UnmarshalJSON(data []byte) (err error)

type MessageStatus

type MessageStatus string

The message delivery status.

const (
	MessageStatusQueued            MessageStatus = "queued"
	MessageStatusSent              MessageStatus = "sent"
	MessageStatusDelivered         MessageStatus = "delivered"
	MessageStatusDeliveryAttempted MessageStatus = "delivery_attempted"
	MessageStatusUndelivered       MessageStatus = "undelivered"
	MessageStatusNotSent           MessageStatus = "not_sent"
	MessageStatusBounced           MessageStatus = "bounced"
)

func (MessageStatus) IsKnown

func (r MessageStatus) IsKnown() bool

type MsTeamsChannelData

type MsTeamsChannelData struct {
	// List of Microsoft Teams connections.
	Connections []MsTeamsChannelDataConnection `json:"connections,required"`
	// Microsoft Teams tenant ID.
	MsTeamsTenantID string                 `json:"ms_teams_tenant_id,nullable" format:"uuid"`
	JSON            msTeamsChannelDataJSON `json:"-"`
}

Microsoft Teams channel data.

func (*MsTeamsChannelData) UnmarshalJSON

func (r *MsTeamsChannelData) UnmarshalJSON(data []byte) (err error)

type MsTeamsChannelDataConnection

type MsTeamsChannelDataConnection struct {
	// This field can have the runtime type of
	// [MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionIncomingWebhook].
	IncomingWebhook interface{} `json:"incoming_webhook"`
	// Microsoft Teams channel ID.
	MsTeamsChannelID string `json:"ms_teams_channel_id,nullable" format:"uuid"`
	// Microsoft Teams team ID.
	MsTeamsTeamID string `json:"ms_teams_team_id,nullable" format:"uuid"`
	// Microsoft Teams tenant ID.
	MsTeamsTenantID string `json:"ms_teams_tenant_id,nullable" format:"uuid"`
	// Microsoft Teams user ID.
	MsTeamsUserID string                           `json:"ms_teams_user_id,nullable" format:"uuid"`
	JSON          msTeamsChannelDataConnectionJSON `json:"-"`
	// contains filtered or unexported fields
}

Microsoft Teams token connection.

func (MsTeamsChannelDataConnection) AsUnion

AsUnion returns a MsTeamsChannelDataConnectionsUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are MsTeamsChannelDataConnectionsMsTeamsTokenConnection, MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnection.

func (*MsTeamsChannelDataConnection) UnmarshalJSON

func (r *MsTeamsChannelDataConnection) UnmarshalJSON(data []byte) (err error)

type MsTeamsChannelDataConnectionParam

type MsTeamsChannelDataConnectionParam struct {
	IncomingWebhook param.Field[interface{}] `json:"incoming_webhook"`
	// Microsoft Teams channel ID.
	MsTeamsChannelID param.Field[string] `json:"ms_teams_channel_id" format:"uuid"`
	// Microsoft Teams team ID.
	MsTeamsTeamID param.Field[string] `json:"ms_teams_team_id" format:"uuid"`
	// Microsoft Teams tenant ID.
	MsTeamsTenantID param.Field[string] `json:"ms_teams_tenant_id" format:"uuid"`
	// Microsoft Teams user ID.
	MsTeamsUserID param.Field[string] `json:"ms_teams_user_id" format:"uuid"`
}

Microsoft Teams token connection.

func (MsTeamsChannelDataConnectionParam) MarshalJSON

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

type MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnection

type MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnection struct {
	// Microsoft Teams incoming webhook.
	IncomingWebhook MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionIncomingWebhook `json:"incoming_webhook,required"`
	JSON            msTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionJSON            `json:"-"`
}

Microsoft Teams incoming webhook connection.

func (*MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnection) UnmarshalJSON

type MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionIncomingWebhook

type MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionIncomingWebhook struct {
	// Microsoft Teams incoming webhook URL.
	URL  string                                                                           `json:"url,required"`
	JSON msTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionIncomingWebhookJSON `json:"-"`
}

Microsoft Teams incoming webhook.

func (*MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionIncomingWebhook) UnmarshalJSON

type MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionIncomingWebhookParam

type MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionIncomingWebhookParam struct {
	// Microsoft Teams incoming webhook URL.
	URL param.Field[string] `json:"url,required"`
}

Microsoft Teams incoming webhook.

func (MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionIncomingWebhookParam) MarshalJSON

type MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionParam

type MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionParam struct {
	// Microsoft Teams incoming webhook.
	IncomingWebhook param.Field[MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionIncomingWebhookParam] `json:"incoming_webhook,required"`
}

Microsoft Teams incoming webhook connection.

func (MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionParam) MarshalJSON

type MsTeamsChannelDataConnectionsMsTeamsTokenConnection

type MsTeamsChannelDataConnectionsMsTeamsTokenConnection struct {
	// Microsoft Teams channel ID.
	MsTeamsChannelID string `json:"ms_teams_channel_id,nullable" format:"uuid"`
	// Microsoft Teams team ID.
	MsTeamsTeamID string `json:"ms_teams_team_id,nullable" format:"uuid"`
	// Microsoft Teams tenant ID.
	MsTeamsTenantID string `json:"ms_teams_tenant_id,nullable" format:"uuid"`
	// Microsoft Teams user ID.
	MsTeamsUserID string                                                  `json:"ms_teams_user_id,nullable" format:"uuid"`
	JSON          msTeamsChannelDataConnectionsMsTeamsTokenConnectionJSON `json:"-"`
}

Microsoft Teams token connection.

func (*MsTeamsChannelDataConnectionsMsTeamsTokenConnection) UnmarshalJSON

func (r *MsTeamsChannelDataConnectionsMsTeamsTokenConnection) UnmarshalJSON(data []byte) (err error)

type MsTeamsChannelDataConnectionsMsTeamsTokenConnectionParam

type MsTeamsChannelDataConnectionsMsTeamsTokenConnectionParam struct {
	// Microsoft Teams channel ID.
	MsTeamsChannelID param.Field[string] `json:"ms_teams_channel_id" format:"uuid"`
	// Microsoft Teams team ID.
	MsTeamsTeamID param.Field[string] `json:"ms_teams_team_id" format:"uuid"`
	// Microsoft Teams tenant ID.
	MsTeamsTenantID param.Field[string] `json:"ms_teams_tenant_id" format:"uuid"`
	// Microsoft Teams user ID.
	MsTeamsUserID param.Field[string] `json:"ms_teams_user_id" format:"uuid"`
}

Microsoft Teams token connection.

func (MsTeamsChannelDataConnectionsMsTeamsTokenConnectionParam) MarshalJSON

type MsTeamsChannelDataConnectionsUnion

type MsTeamsChannelDataConnectionsUnion interface {
	// contains filtered or unexported methods
}

Microsoft Teams token connection.

Union satisfied by MsTeamsChannelDataConnectionsMsTeamsTokenConnection or MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnection.

type MsTeamsChannelDataConnectionsUnionParam

type MsTeamsChannelDataConnectionsUnionParam interface {
	// contains filtered or unexported methods
}

Microsoft Teams token connection.

Satisfied by MsTeamsChannelDataConnectionsMsTeamsTokenConnectionParam, MsTeamsChannelDataConnectionsMsTeamsIncomingWebhookConnectionParam, MsTeamsChannelDataConnectionParam.

type MsTeamsChannelDataParam

type MsTeamsChannelDataParam struct {
	// List of Microsoft Teams connections.
	Connections param.Field[[]MsTeamsChannelDataConnectionsUnionParam] `json:"connections,required"`
	// Microsoft Teams tenant ID.
	MsTeamsTenantID param.Field[string] `json:"ms_teams_tenant_id" format:"uuid"`
}

Microsoft Teams channel data.

func (MsTeamsChannelDataParam) MarshalJSON

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

type Object

type Object struct {
	// Unique identifier for the object.
	ID string `json:"id,required"`
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The collection this object belongs to.
	Collection string `json:"collection,required"`
	// The timestamp when the resource was last updated.
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// Timestamp when the resource was created.
	CreatedAt time.Time `json:"created_at,nullable" format:"date-time"`
	// The custom properties associated with the object.
	Properties map[string]interface{} `json:"properties"`
	JSON       objectJSON             `json:"-"`
}

A custom Object(/concepts/objects) entity which belongs to a collection.

func (*Object) UnmarshalJSON

func (r *Object) UnmarshalJSON(data []byte) (err error)

type ObjectAddSubscriptionsParams

type ObjectAddSubscriptionsParams struct {
	// The recipients of the subscription. You can subscribe up to 100 recipients to an
	// object at a time.
	Recipients param.Field[[]RecipientRequestUnionParam] `json:"recipients,required"`
	// The custom properties associated with the subscription relationship.
	Properties param.Field[map[string]interface{}] `json:"properties"`
}

func (ObjectAddSubscriptionsParams) MarshalJSON

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

type ObjectBulkAddSubscriptionsParams

type ObjectBulkAddSubscriptionsParams struct {
	// A list of subscriptions.
	Subscriptions param.Field[[]ObjectBulkAddSubscriptionsParamsSubscription] `json:"subscriptions,required"`
}

func (ObjectBulkAddSubscriptionsParams) MarshalJSON

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

type ObjectBulkAddSubscriptionsParamsSubscription

type ObjectBulkAddSubscriptionsParamsSubscription struct {
	// The recipients of the subscription. You can subscribe up to 100 recipients to an
	// object at a time.
	Recipients param.Field[[]RecipientRequestUnionParam] `json:"recipients,required"`
	// The custom properties associated with the subscription relationship.
	Properties param.Field[map[string]interface{}] `json:"properties"`
}

func (ObjectBulkAddSubscriptionsParamsSubscription) MarshalJSON

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

type ObjectBulkDeleteParams

type ObjectBulkDeleteParams struct {
	// List of object IDs to delete.
	ObjectIDs param.Field[[]string] `json:"object_ids,required"`
}

func (ObjectBulkDeleteParams) MarshalJSON

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

type ObjectBulkService

type ObjectBulkService struct {
	Options []option.RequestOption
}

ObjectBulkService contains methods and other services that help with interacting with the knock 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 NewObjectBulkService method instead.

func NewObjectBulkService

func NewObjectBulkService(opts ...option.RequestOption) (r *ObjectBulkService)

NewObjectBulkService 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 (*ObjectBulkService) AddSubscriptions

func (r *ObjectBulkService) AddSubscriptions(ctx context.Context, collection string, body ObjectBulkAddSubscriptionsParams, opts ...option.RequestOption) (res *BulkOperation, err error)

Add subscriptions for all objects in a single collection. If a subscription for an object in the collection already exists, it will be updated. This endpoint also handles [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients) for the `recipient` field.

func (*ObjectBulkService) Delete

func (r *ObjectBulkService) Delete(ctx context.Context, collection string, body ObjectBulkDeleteParams, opts ...option.RequestOption) (res *BulkOperation, err error)

Bulk deletes objects from the specified collection.

func (*ObjectBulkService) Set

func (r *ObjectBulkService) Set(ctx context.Context, collection string, body ObjectBulkSetParams, opts ...option.RequestOption) (res *BulkOperation, err error)

Bulk sets up to 1,000 objects at a time in the specified collection.

type ObjectBulkSetParams

type ObjectBulkSetParams struct {
	// A list of objects.
	Objects param.Field[[]ObjectBulkSetParamsObject] `json:"objects,required"`
}

func (ObjectBulkSetParams) MarshalJSON

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

type ObjectBulkSetParamsObject added in v1.5.0

type ObjectBulkSetParamsObject struct {
	// Unique identifier for the object.
	ID param.Field[string] `json:"id,required"`
	// A request to set channel data for a type of channel inline.
	ChannelData param.Field[InlineChannelDataRequestParam] `json:"channel_data"`
	// Timestamp when the resource was created.
	CreatedAt param.Field[time.Time] `json:"created_at" format:"date-time"`
	// Inline set preferences for a recipient, where the key is the preference set id.
	// Preferences that are set inline will be merged into any existing preferences
	// rather than replacing them.
	Preferences param.Field[InlinePreferenceSetRequestParam] `json:"preferences"`
	ExtraFields map[string]interface{}                       `json:"-,extras"`
}

A custom Object(/concepts/objects) entity which belongs to a collection.

func (ObjectBulkSetParamsObject) MarshalJSON added in v1.5.0

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

type ObjectDeleteSubscriptionsParams

type ObjectDeleteSubscriptionsParams struct {
	// The recipients of the subscription. You can subscribe up to 100 recipients to an
	// object at a time.
	Recipients param.Field[[]RecipientReferenceUnionParam] `json:"recipients,required"`
}

func (ObjectDeleteSubscriptionsParams) MarshalJSON

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

type ObjectListMessagesParams

type ObjectListMessagesParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// Limits the results to items with the corresponding channel ID.
	ChannelID param.Field[string] `query:"channel_id"`
	// Limits the results to messages with the given engagement status.
	EngagementStatus param.Field[[]ObjectListMessagesParamsEngagementStatus] `query:"engagement_status"`
	InsertedAt       param.Field[ObjectListMessagesParamsInsertedAt]         `query:"inserted_at"`
	// Limits the results to only the message IDs given (max 50). Note: when using this
	// option, the results will be subject to any other filters applied to the query.
	MessageIDs param.Field[[]string] `query:"message_ids"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
	// Limits the results to messages triggered by the given workflow key.
	Source param.Field[string] `query:"source"`
	// Limits the results to messages with the given delivery status.
	Status param.Field[[]ObjectListMessagesParamsStatus] `query:"status"`
	// Limits the results to items with the corresponding tenant.
	Tenant param.Field[string] `query:"tenant"`
	// Limits the results to only messages that were generated with the given data. See
	// [trigger data filtering](/api-reference/overview/trigger-data-filtering) for
	// more information.
	TriggerData param.Field[string] `query:"trigger_data"`
	// Limits the results to messages related to any of the provided categories.
	WorkflowCategories param.Field[[]string] `query:"workflow_categories"`
	// Limits the results to messages for a specific recipient's workflow run.
	WorkflowRecipientRunID param.Field[string] `query:"workflow_recipient_run_id" format:"uuid"`
	// Limits the results to messages associated with the top-level workflow run ID
	// returned by the workflow trigger request.
	WorkflowRunID param.Field[string] `query:"workflow_run_id" format:"uuid"`
}

func (ObjectListMessagesParams) URLQuery

func (r ObjectListMessagesParams) URLQuery() (v url.Values)

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

type ObjectListMessagesParamsEngagementStatus

type ObjectListMessagesParamsEngagementStatus string
const (
	ObjectListMessagesParamsEngagementStatusSeen        ObjectListMessagesParamsEngagementStatus = "seen"
	ObjectListMessagesParamsEngagementStatusUnseen      ObjectListMessagesParamsEngagementStatus = "unseen"
	ObjectListMessagesParamsEngagementStatusRead        ObjectListMessagesParamsEngagementStatus = "read"
	ObjectListMessagesParamsEngagementStatusUnread      ObjectListMessagesParamsEngagementStatus = "unread"
	ObjectListMessagesParamsEngagementStatusArchived    ObjectListMessagesParamsEngagementStatus = "archived"
	ObjectListMessagesParamsEngagementStatusUnarchived  ObjectListMessagesParamsEngagementStatus = "unarchived"
	ObjectListMessagesParamsEngagementStatusLinkClicked ObjectListMessagesParamsEngagementStatus = "link_clicked"
	ObjectListMessagesParamsEngagementStatusInteracted  ObjectListMessagesParamsEngagementStatus = "interacted"
)

func (ObjectListMessagesParamsEngagementStatus) IsKnown

type ObjectListMessagesParamsInsertedAt

type ObjectListMessagesParamsInsertedAt struct {
	// Limits the results to messages inserted after the given date.
	Gt param.Field[string] `query:"gt"`
	// Limits the results to messages inserted after or on the given date.
	Gte param.Field[string] `query:"gte"`
	// Limits the results to messages inserted before the given date.
	Lt param.Field[string] `query:"lt"`
	// Limits the results to messages inserted before or on the given date.
	Lte param.Field[string] `query:"lte"`
}

func (ObjectListMessagesParamsInsertedAt) URLQuery

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

type ObjectListMessagesParamsStatus

type ObjectListMessagesParamsStatus string
const (
	ObjectListMessagesParamsStatusQueued            ObjectListMessagesParamsStatus = "queued"
	ObjectListMessagesParamsStatusSent              ObjectListMessagesParamsStatus = "sent"
	ObjectListMessagesParamsStatusDelivered         ObjectListMessagesParamsStatus = "delivered"
	ObjectListMessagesParamsStatusDeliveryAttempted ObjectListMessagesParamsStatus = "delivery_attempted"
	ObjectListMessagesParamsStatusUndelivered       ObjectListMessagesParamsStatus = "undelivered"
	ObjectListMessagesParamsStatusNotSent           ObjectListMessagesParamsStatus = "not_sent"
	ObjectListMessagesParamsStatusBounced           ObjectListMessagesParamsStatus = "bounced"
)

func (ObjectListMessagesParamsStatus) IsKnown

type ObjectListParams

type ObjectListParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// Includes preferences of the objects in the response.
	Include param.Field[[]ObjectListParamsInclude] `query:"include"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
}

func (ObjectListParams) URLQuery

func (r ObjectListParams) URLQuery() (v url.Values)

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

type ObjectListParamsInclude

type ObjectListParamsInclude string
const (
	ObjectListParamsIncludePreferences ObjectListParamsInclude = "preferences"
)

func (ObjectListParamsInclude) IsKnown

func (r ObjectListParamsInclude) IsKnown() bool

type ObjectListSchedulesParams

type ObjectListSchedulesParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
	// Filter schedules by tenant id.
	Tenant param.Field[string] `query:"tenant"`
	// Filter schedules by workflow id.
	Workflow param.Field[string] `query:"workflow"`
}

func (ObjectListSchedulesParams) URLQuery

func (r ObjectListSchedulesParams) URLQuery() (v url.Values)

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

type ObjectListSubscriptionsParams

type ObjectListSubscriptionsParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// Additional fields to include in the response.
	Include param.Field[[]ObjectListSubscriptionsParamsInclude] `query:"include"`
	// Mode of the request. `recipient` to list the objects that the provided object is
	// subscribed to, `object` to list the recipients that subscribe to the provided
	// object.
	Mode param.Field[ObjectListSubscriptionsParamsMode] `query:"mode"`
	// Objects to filter by (only used if mode is `recipient`).
	Objects param.Field[[]ObjectListSubscriptionsParamsObject] `query:"objects"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
	// Recipients to filter by (only used if mode is `object`).
	Recipients param.Field[[]RecipientReferenceUnionParam] `query:"recipients"`
}

func (ObjectListSubscriptionsParams) URLQuery

func (r ObjectListSubscriptionsParams) URLQuery() (v url.Values)

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

type ObjectListSubscriptionsParamsInclude

type ObjectListSubscriptionsParamsInclude string
const (
	ObjectListSubscriptionsParamsIncludePreferences ObjectListSubscriptionsParamsInclude = "preferences"
)

func (ObjectListSubscriptionsParamsInclude) IsKnown

type ObjectListSubscriptionsParamsMode

type ObjectListSubscriptionsParamsMode string

Mode of the request. `recipient` to list the objects that the provided object is subscribed to, `object` to list the recipients that subscribe to the provided object.

const (
	ObjectListSubscriptionsParamsModeRecipient ObjectListSubscriptionsParamsMode = "recipient"
	ObjectListSubscriptionsParamsModeObject    ObjectListSubscriptionsParamsMode = "object"
)

func (ObjectListSubscriptionsParamsMode) IsKnown

type ObjectListSubscriptionsParamsObject

type ObjectListSubscriptionsParamsObject struct {
	// An identifier for the recipient object.
	ID param.Field[string] `query:"id"`
	// The collection the recipient object belongs to.
	Collection param.Field[string] `query:"collection"`
}

A reference to a recipient object.

func (ObjectListSubscriptionsParamsObject) URLQuery

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

type ObjectService

type ObjectService struct {
	Options []option.RequestOption
	Bulk    *ObjectBulkService
}

ObjectService contains methods and other services that help with interacting with the knock 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 NewObjectService method instead.

func NewObjectService

func NewObjectService(opts ...option.RequestOption) (r *ObjectService)

NewObjectService 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 (*ObjectService) AddSubscriptions

func (r *ObjectService) AddSubscriptions(ctx context.Context, collection string, objectID string, body ObjectAddSubscriptionsParams, opts ...option.RequestOption) (res *[]Subscription, err error)

Add subscriptions for an object. If a subscription already exists, it will be updated. This endpoint also handles [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients) for the `recipient`.

func (*ObjectService) Delete

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

Permanently removes an object from the specified collection. This operation cannot be undone.

func (*ObjectService) DeleteSubscriptions

func (r *ObjectService) DeleteSubscriptions(ctx context.Context, collection string, objectID string, body ObjectDeleteSubscriptionsParams, opts ...option.RequestOption) (res *[]Subscription, err error)

Delete subscriptions for the specified recipients from an object. Returns the list of deleted subscriptions.

func (*ObjectService) Get

func (r *ObjectService) Get(ctx context.Context, collection string, id string, opts ...option.RequestOption) (res *Object, err error)

Retrieves a specific object by its ID from the specified collection. Returns the object with all its properties.

func (*ObjectService) GetChannelData

func (r *ObjectService) GetChannelData(ctx context.Context, collection string, objectID string, channelID string, opts ...option.RequestOption) (res *ChannelData, err error)

Returns the channel data for the specified object and channel.

func (*ObjectService) GetPreferences

func (r *ObjectService) GetPreferences(ctx context.Context, collection string, objectID string, id string, opts ...option.RequestOption) (res *PreferenceSet, err error)

Returns the preference set for the specified object and preference set `id`.

func (*ObjectService) List

func (r *ObjectService) List(ctx context.Context, collection string, query ObjectListParams, opts ...option.RequestOption) (res *pagination.EntriesCursor[Object], err error)

Returns a paginated list of objects from the specified collection. Optionally includes preference data for the objects.

func (*ObjectService) ListAutoPaging

func (r *ObjectService) ListAutoPaging(ctx context.Context, collection string, query ObjectListParams, opts ...option.RequestOption) *pagination.EntriesCursorAutoPager[Object]

Returns a paginated list of objects from the specified collection. Optionally includes preference data for the objects.

func (*ObjectService) ListMessages

func (r *ObjectService) ListMessages(ctx context.Context, collection string, id string, query ObjectListMessagesParams, opts ...option.RequestOption) (res *pagination.ItemsCursor[Message], err error)

Returns a paginated list of messages for a specific object in the given collection. Allows filtering by message status and provides various sorting options.

func (*ObjectService) ListMessagesAutoPaging

func (r *ObjectService) ListMessagesAutoPaging(ctx context.Context, collection string, id string, query ObjectListMessagesParams, opts ...option.RequestOption) *pagination.ItemsCursorAutoPager[Message]

Returns a paginated list of messages for a specific object in the given collection. Allows filtering by message status and provides various sorting options.

func (*ObjectService) ListPreferences

func (r *ObjectService) ListPreferences(ctx context.Context, collection string, objectID string, opts ...option.RequestOption) (res *[]PreferenceSet, err error)

Returns a paginated list of preference sets for the specified object.

func (*ObjectService) ListSchedules

func (r *ObjectService) ListSchedules(ctx context.Context, collection string, id string, query ObjectListSchedulesParams, opts ...option.RequestOption) (res *pagination.EntriesCursor[Schedule], err error)

Returns a paginated list of schedules for an object.

func (*ObjectService) ListSchedulesAutoPaging

func (r *ObjectService) ListSchedulesAutoPaging(ctx context.Context, collection string, id string, query ObjectListSchedulesParams, opts ...option.RequestOption) *pagination.EntriesCursorAutoPager[Schedule]

Returns a paginated list of schedules for an object.

func (*ObjectService) ListSubscriptions

func (r *ObjectService) ListSubscriptions(ctx context.Context, collection string, objectID string, query ObjectListSubscriptionsParams, opts ...option.RequestOption) (res *pagination.EntriesCursor[Subscription], err error)

List subscriptions for an object. Either list the recipients that subscribe to the provided object, or list the objects that the provided object is subscribed to. Determined by the `mode` query parameter.

func (*ObjectService) ListSubscriptionsAutoPaging

func (r *ObjectService) ListSubscriptionsAutoPaging(ctx context.Context, collection string, objectID string, query ObjectListSubscriptionsParams, opts ...option.RequestOption) *pagination.EntriesCursorAutoPager[Subscription]

List subscriptions for an object. Either list the recipients that subscribe to the provided object, or list the objects that the provided object is subscribed to. Determined by the `mode` query parameter.

func (*ObjectService) Set

func (r *ObjectService) Set(ctx context.Context, collection string, id string, body ObjectSetParams, opts ...option.RequestOption) (res *Object, err error)

Creates a new object or updates an existing one in the specified collection. This operation is used to identify objects with their properties, as well as optional preferences and channel data.

func (*ObjectService) SetChannelData

func (r *ObjectService) SetChannelData(ctx context.Context, collection string, objectID string, channelID string, body ObjectSetChannelDataParams, opts ...option.RequestOption) (res *ChannelData, err error)

Sets the channel data for the specified object and channel. If no object exists in the current environment for the given `collection` and `object_id`, Knock will create the object as part of this request.

func (*ObjectService) SetPreferences

func (r *ObjectService) SetPreferences(ctx context.Context, collection string, objectID string, id string, body ObjectSetPreferencesParams, opts ...option.RequestOption) (res *PreferenceSet, err error)

Sets preferences within the given preference set. By default, this is a destructive operation and will replace any existing preferences with the preferences given. Use '\_\_persistence_strategy': 'merge' to merge with existing preferences instead. If no object exists in the current environment for the given `:collection` and `:object_id`, Knock will create the object as part of this request. The preference set `:id` can be either `default` or a `tenant.id`. Learn more about [per-tenant preferences](/preferences/tenant-preferences).

func (*ObjectService) UnsetChannelData

func (r *ObjectService) UnsetChannelData(ctx context.Context, collection string, objectID string, channelID string, opts ...option.RequestOption) (res *string, err error)

Unsets the channel data for the specified object and channel.

type ObjectSetChannelDataParams

type ObjectSetChannelDataParams struct {
	// A request to set channel data for a type of channel.
	ChannelDataRequest ChannelDataRequestParam `json:"channel_data_request,required"`
}

func (ObjectSetChannelDataParams) MarshalJSON

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

type ObjectSetParams

type ObjectSetParams struct {
	// A request to set channel data for a type of channel inline.
	ChannelData param.Field[InlineChannelDataRequestParam] `json:"channel_data"`
	// The locale of the object. Used for
	// [message localization](/concepts/translations).
	Locale param.Field[string] `json:"locale"`
	// Inline set preferences for a recipient, where the key is the preference set id.
	// Preferences that are set inline will be merged into any existing preferences
	// rather than replacing them.
	Preferences param.Field[InlinePreferenceSetRequestParam] `json:"preferences"`
	// The timezone of the object. Must be a
	// valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
	// Used
	// for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
	Timezone param.Field[string] `json:"timezone"`
}

func (ObjectSetParams) MarshalJSON

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

type ObjectSetPreferencesParams

type ObjectSetPreferencesParams struct {
	// A request to set a preference set for a recipient.
	PreferenceSetRequest PreferenceSetRequestParam `json:"preference_set_request,required"`
}

func (ObjectSetPreferencesParams) MarshalJSON

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

type OneSignalChannelData

type OneSignalChannelData struct {
	// A list of OneSignal player IDs.
	PlayerIDs []string                 `json:"player_ids,required" format:"uuid"`
	JSON      oneSignalChannelDataJSON `json:"-"`
}

OneSignal channel data.

func (*OneSignalChannelData) UnmarshalJSON

func (r *OneSignalChannelData) UnmarshalJSON(data []byte) (err error)

type OneSignalChannelDataParam

type OneSignalChannelDataParam struct {
	// A list of OneSignal player IDs.
	PlayerIDs param.Field[[]string] `json:"player_ids,required" format:"uuid"`
}

OneSignal channel data.

func (OneSignalChannelDataParam) MarshalJSON

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

type PageInfo

type PageInfo struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The number of items per page (defaults to 50).
	PageSize int64 `json:"page_size,required"`
	// The cursor to fetch entries after.
	After string `json:"after,nullable"`
	// The cursor to fetch entries before.
	Before string       `json:"before,nullable"`
	JSON   pageInfoJSON `json:"-"`
}

Pagination information for a list of resources.

func (*PageInfo) UnmarshalJSON

func (r *PageInfo) UnmarshalJSON(data []byte) (err error)

type PreferenceSet

type PreferenceSet struct {
	// Unique identifier for the preference set.
	ID string `json:"id,required"`
	// An object where the key is the category and the values are the preference
	// settings for that category.
	Categories map[string]PreferenceSetCategoriesUnion `json:"categories,nullable"`
	// Channel type preferences.
	ChannelTypes PreferenceSetChannelTypes `json:"channel_types,nullable"`
	// An object where the key is the workflow key and the values are the preference
	// settings for that workflow.
	Workflows map[string]PreferenceSetWorkflowsUnion `json:"workflows,nullable"`
	JSON      preferenceSetJSON                      `json:"-"`
}

A preference set represents a specific set of notification preferences for a recipient. A recipient can have multiple preference sets.

func (*PreferenceSet) UnmarshalJSON

func (r *PreferenceSet) UnmarshalJSON(data []byte) (err error)

type PreferenceSetCategoriesPreferenceSetWorkflowCategorySettingObject

type PreferenceSetCategoriesPreferenceSetWorkflowCategorySettingObject struct {
	// Channel type preferences.
	ChannelTypes PreferenceSetChannelTypes `json:"channel_types,nullable"`
	// A list of conditions to apply to a channel type.
	Conditions []Condition                                                           `json:"conditions,nullable"`
	JSON       preferenceSetCategoriesPreferenceSetWorkflowCategorySettingObjectJSON `json:"-"`
}

The settings object for a workflow or category, where you can specify channel types or conditions.

func (PreferenceSetCategoriesPreferenceSetWorkflowCategorySettingObject) ImplementsPreferenceSetCategoriesUnion

func (r PreferenceSetCategoriesPreferenceSetWorkflowCategorySettingObject) ImplementsPreferenceSetCategoriesUnion()

func (*PreferenceSetCategoriesPreferenceSetWorkflowCategorySettingObject) UnmarshalJSON

type PreferenceSetCategoriesUnion

type PreferenceSetCategoriesUnion interface {
	ImplementsPreferenceSetCategoriesUnion()
}

Workflow or category preferences within a preference set

Union satisfied by shared.UnionBool or PreferenceSetCategoriesPreferenceSetWorkflowCategorySettingObject.

type PreferenceSetChannelTypeSetting

type PreferenceSetChannelTypeSetting struct {
	// A list of conditions to apply to a channel type.
	Conditions []Condition                         `json:"conditions,required"`
	JSON       preferenceSetChannelTypeSettingJSON `json:"-"`
}

A set of settings for a channel type. Currently, this can only be a list of conditions to apply.

func (PreferenceSetChannelTypeSetting) ImplementsPreferenceSetChannelTypesChatUnion

func (r PreferenceSetChannelTypeSetting) ImplementsPreferenceSetChannelTypesChatUnion()

func (PreferenceSetChannelTypeSetting) ImplementsPreferenceSetChannelTypesEmailUnion

func (r PreferenceSetChannelTypeSetting) ImplementsPreferenceSetChannelTypesEmailUnion()

func (PreferenceSetChannelTypeSetting) ImplementsPreferenceSetChannelTypesHTTPUnion

func (r PreferenceSetChannelTypeSetting) ImplementsPreferenceSetChannelTypesHTTPUnion()

func (PreferenceSetChannelTypeSetting) ImplementsPreferenceSetChannelTypesInAppFeedUnion

func (r PreferenceSetChannelTypeSetting) ImplementsPreferenceSetChannelTypesInAppFeedUnion()

func (PreferenceSetChannelTypeSetting) ImplementsPreferenceSetChannelTypesPushUnion

func (r PreferenceSetChannelTypeSetting) ImplementsPreferenceSetChannelTypesPushUnion()

func (PreferenceSetChannelTypeSetting) ImplementsPreferenceSetChannelTypesSMSUnion

func (r PreferenceSetChannelTypeSetting) ImplementsPreferenceSetChannelTypesSMSUnion()

func (*PreferenceSetChannelTypeSetting) UnmarshalJSON

func (r *PreferenceSetChannelTypeSetting) UnmarshalJSON(data []byte) (err error)

type PreferenceSetChannelTypeSettingParam

type PreferenceSetChannelTypeSettingParam struct {
	// A list of conditions to apply to a channel type.
	Conditions param.Field[[]ConditionParam] `json:"conditions,required"`
}

A set of settings for a channel type. Currently, this can only be a list of conditions to apply.

func (PreferenceSetChannelTypeSettingParam) ImplementsPreferenceSetChannelTypesChatUnionParam

func (r PreferenceSetChannelTypeSettingParam) ImplementsPreferenceSetChannelTypesChatUnionParam()

func (PreferenceSetChannelTypeSettingParam) ImplementsPreferenceSetChannelTypesEmailUnionParam

func (r PreferenceSetChannelTypeSettingParam) ImplementsPreferenceSetChannelTypesEmailUnionParam()

func (PreferenceSetChannelTypeSettingParam) ImplementsPreferenceSetChannelTypesHTTPUnionParam

func (r PreferenceSetChannelTypeSettingParam) ImplementsPreferenceSetChannelTypesHTTPUnionParam()

func (PreferenceSetChannelTypeSettingParam) ImplementsPreferenceSetChannelTypesInAppFeedUnionParam

func (r PreferenceSetChannelTypeSettingParam) ImplementsPreferenceSetChannelTypesInAppFeedUnionParam()

func (PreferenceSetChannelTypeSettingParam) ImplementsPreferenceSetChannelTypesPushUnionParam

func (r PreferenceSetChannelTypeSettingParam) ImplementsPreferenceSetChannelTypesPushUnionParam()

func (PreferenceSetChannelTypeSettingParam) ImplementsPreferenceSetChannelTypesSMSUnionParam

func (r PreferenceSetChannelTypeSettingParam) ImplementsPreferenceSetChannelTypesSMSUnionParam()

func (PreferenceSetChannelTypeSettingParam) MarshalJSON

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

type PreferenceSetChannelTypes

type PreferenceSetChannelTypes struct {
	// Whether the channel type is enabled for the preference set.
	Chat PreferenceSetChannelTypesChatUnion `json:"chat"`
	// Whether the channel type is enabled for the preference set.
	Email PreferenceSetChannelTypesEmailUnion `json:"email"`
	// Whether the channel type is enabled for the preference set.
	HTTP PreferenceSetChannelTypesHTTPUnion `json:"http"`
	// Whether the channel type is enabled for the preference set.
	InAppFeed PreferenceSetChannelTypesInAppFeedUnion `json:"in_app_feed"`
	// Whether the channel type is enabled for the preference set.
	Push PreferenceSetChannelTypesPushUnion `json:"push"`
	// Whether the channel type is enabled for the preference set.
	SMS  PreferenceSetChannelTypesSMSUnion `json:"sms"`
	JSON preferenceSetChannelTypesJSON     `json:"-"`
}

Channel type preferences.

func (*PreferenceSetChannelTypes) UnmarshalJSON

func (r *PreferenceSetChannelTypes) UnmarshalJSON(data []byte) (err error)

type PreferenceSetChannelTypesChatUnion

type PreferenceSetChannelTypesChatUnion interface {
	ImplementsPreferenceSetChannelTypesChatUnion()
}

Whether the channel type is enabled for the preference set.

Union satisfied by shared.UnionBool or PreferenceSetChannelTypeSetting.

type PreferenceSetChannelTypesChatUnionParam

type PreferenceSetChannelTypesChatUnionParam interface {
	ImplementsPreferenceSetChannelTypesChatUnionParam()
}

Whether the channel type is enabled for the preference set.

Satisfied by shared.UnionBool, PreferenceSetChannelTypeSettingParam.

type PreferenceSetChannelTypesEmailUnion

type PreferenceSetChannelTypesEmailUnion interface {
	ImplementsPreferenceSetChannelTypesEmailUnion()
}

Whether the channel type is enabled for the preference set.

Union satisfied by shared.UnionBool or PreferenceSetChannelTypeSetting.

type PreferenceSetChannelTypesEmailUnionParam

type PreferenceSetChannelTypesEmailUnionParam interface {
	ImplementsPreferenceSetChannelTypesEmailUnionParam()
}

Whether the channel type is enabled for the preference set.

Satisfied by shared.UnionBool, PreferenceSetChannelTypeSettingParam.

type PreferenceSetChannelTypesHTTPUnion

type PreferenceSetChannelTypesHTTPUnion interface {
	ImplementsPreferenceSetChannelTypesHTTPUnion()
}

Whether the channel type is enabled for the preference set.

Union satisfied by shared.UnionBool or PreferenceSetChannelTypeSetting.

type PreferenceSetChannelTypesHTTPUnionParam

type PreferenceSetChannelTypesHTTPUnionParam interface {
	ImplementsPreferenceSetChannelTypesHTTPUnionParam()
}

Whether the channel type is enabled for the preference set.

Satisfied by shared.UnionBool, PreferenceSetChannelTypeSettingParam.

type PreferenceSetChannelTypesInAppFeedUnion

type PreferenceSetChannelTypesInAppFeedUnion interface {
	ImplementsPreferenceSetChannelTypesInAppFeedUnion()
}

Whether the channel type is enabled for the preference set.

Union satisfied by shared.UnionBool or PreferenceSetChannelTypeSetting.

type PreferenceSetChannelTypesInAppFeedUnionParam

type PreferenceSetChannelTypesInAppFeedUnionParam interface {
	ImplementsPreferenceSetChannelTypesInAppFeedUnionParam()
}

Whether the channel type is enabled for the preference set.

Satisfied by shared.UnionBool, PreferenceSetChannelTypeSettingParam.

type PreferenceSetChannelTypesParam

type PreferenceSetChannelTypesParam struct {
	// Whether the channel type is enabled for the preference set.
	Chat param.Field[PreferenceSetChannelTypesChatUnionParam] `json:"chat"`
	// Whether the channel type is enabled for the preference set.
	Email param.Field[PreferenceSetChannelTypesEmailUnionParam] `json:"email"`
	// Whether the channel type is enabled for the preference set.
	HTTP param.Field[PreferenceSetChannelTypesHTTPUnionParam] `json:"http"`
	// Whether the channel type is enabled for the preference set.
	InAppFeed param.Field[PreferenceSetChannelTypesInAppFeedUnionParam] `json:"in_app_feed"`
	// Whether the channel type is enabled for the preference set.
	Push param.Field[PreferenceSetChannelTypesPushUnionParam] `json:"push"`
	// Whether the channel type is enabled for the preference set.
	SMS param.Field[PreferenceSetChannelTypesSMSUnionParam] `json:"sms"`
}

Channel type preferences.

func (PreferenceSetChannelTypesParam) MarshalJSON

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

type PreferenceSetChannelTypesPushUnion

type PreferenceSetChannelTypesPushUnion interface {
	ImplementsPreferenceSetChannelTypesPushUnion()
}

Whether the channel type is enabled for the preference set.

Union satisfied by shared.UnionBool or PreferenceSetChannelTypeSetting.

type PreferenceSetChannelTypesPushUnionParam

type PreferenceSetChannelTypesPushUnionParam interface {
	ImplementsPreferenceSetChannelTypesPushUnionParam()
}

Whether the channel type is enabled for the preference set.

Satisfied by shared.UnionBool, PreferenceSetChannelTypeSettingParam.

type PreferenceSetChannelTypesSMSUnion

type PreferenceSetChannelTypesSMSUnion interface {
	ImplementsPreferenceSetChannelTypesSMSUnion()
}

Whether the channel type is enabled for the preference set.

Union satisfied by shared.UnionBool or PreferenceSetChannelTypeSetting.

type PreferenceSetChannelTypesSMSUnionParam

type PreferenceSetChannelTypesSMSUnionParam interface {
	ImplementsPreferenceSetChannelTypesSMSUnionParam()
}

Whether the channel type is enabled for the preference set.

Satisfied by shared.UnionBool, PreferenceSetChannelTypeSettingParam.

type PreferenceSetRequestCategoriesPreferenceSetWorkflowCategorySettingObjectParam

type PreferenceSetRequestCategoriesPreferenceSetWorkflowCategorySettingObjectParam struct {
	// Channel type preferences.
	ChannelTypes param.Field[PreferenceSetChannelTypesParam] `json:"channel_types"`
	// A list of conditions to apply to a channel type.
	Conditions param.Field[[]ConditionParam] `json:"conditions"`
}

The settings object for a workflow or category, where you can specify channel types or conditions.

func (PreferenceSetRequestCategoriesPreferenceSetWorkflowCategorySettingObjectParam) ImplementsPreferenceSetRequestCategoriesUnionParam

func (r PreferenceSetRequestCategoriesPreferenceSetWorkflowCategorySettingObjectParam) ImplementsPreferenceSetRequestCategoriesUnionParam()

func (PreferenceSetRequestCategoriesPreferenceSetWorkflowCategorySettingObjectParam) MarshalJSON

type PreferenceSetRequestCategoriesUnionParam

type PreferenceSetRequestCategoriesUnionParam interface {
	ImplementsPreferenceSetRequestCategoriesUnionParam()
}

Workflow or category preferences within a preference set

Satisfied by shared.UnionBool, PreferenceSetRequestCategoriesPreferenceSetWorkflowCategorySettingObjectParam.

type PreferenceSetRequestParam

type PreferenceSetRequestParam struct {
	// Controls how the preference set is persisted. 'replace' will completely replace
	// the preference set, 'merge' will merge with existing preferences.
	PersistenceStrategy param.Field[PreferenceSetRequest_PersistenceStrategy] `json:"__persistence_strategy__"`
	// An object where the key is the category and the values are the preference
	// settings for that category.
	Categories param.Field[map[string]PreferenceSetRequestCategoriesUnionParam] `json:"categories"`
	// Channel type preferences.
	ChannelTypes param.Field[PreferenceSetChannelTypesParam] `json:"channel_types"`
	// An object where the key is the workflow key and the values are the preference
	// settings for that workflow.
	Workflows param.Field[map[string]PreferenceSetRequestWorkflowsUnionParam] `json:"workflows"`
}

A request to set a preference set for a recipient.

func (PreferenceSetRequestParam) MarshalJSON

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

type PreferenceSetRequestWorkflowsPreferenceSetWorkflowCategorySettingObjectParam

type PreferenceSetRequestWorkflowsPreferenceSetWorkflowCategorySettingObjectParam struct {
	// Channel type preferences.
	ChannelTypes param.Field[PreferenceSetChannelTypesParam] `json:"channel_types"`
	// A list of conditions to apply to a channel type.
	Conditions param.Field[[]ConditionParam] `json:"conditions"`
}

The settings object for a workflow or category, where you can specify channel types or conditions.

func (PreferenceSetRequestWorkflowsPreferenceSetWorkflowCategorySettingObjectParam) ImplementsPreferenceSetRequestWorkflowsUnionParam

func (r PreferenceSetRequestWorkflowsPreferenceSetWorkflowCategorySettingObjectParam) ImplementsPreferenceSetRequestWorkflowsUnionParam()

func (PreferenceSetRequestWorkflowsPreferenceSetWorkflowCategorySettingObjectParam) MarshalJSON

type PreferenceSetRequestWorkflowsUnionParam

type PreferenceSetRequestWorkflowsUnionParam interface {
	ImplementsPreferenceSetRequestWorkflowsUnionParam()
}

Workflow or category preferences within a preference set

Satisfied by shared.UnionBool, PreferenceSetRequestWorkflowsPreferenceSetWorkflowCategorySettingObjectParam.

type PreferenceSetRequest_PersistenceStrategy added in v1.11.0

type PreferenceSetRequest_PersistenceStrategy string

Controls how the preference set is persisted. 'replace' will completely replace the preference set, 'merge' will merge with existing preferences.

const (
	PreferenceSetRequest_PersistenceStrategyMerge   PreferenceSetRequest_PersistenceStrategy = "merge"
	PreferenceSetRequest_PersistenceStrategyReplace PreferenceSetRequest_PersistenceStrategy = "replace"
)

func (PreferenceSetRequest_PersistenceStrategy) IsKnown added in v1.11.0

type PreferenceSetWorkflowsPreferenceSetWorkflowCategorySettingObject

type PreferenceSetWorkflowsPreferenceSetWorkflowCategorySettingObject struct {
	// Channel type preferences.
	ChannelTypes PreferenceSetChannelTypes `json:"channel_types,nullable"`
	// A list of conditions to apply to a channel type.
	Conditions []Condition                                                          `json:"conditions,nullable"`
	JSON       preferenceSetWorkflowsPreferenceSetWorkflowCategorySettingObjectJSON `json:"-"`
}

The settings object for a workflow or category, where you can specify channel types or conditions.

func (PreferenceSetWorkflowsPreferenceSetWorkflowCategorySettingObject) ImplementsPreferenceSetWorkflowsUnion

func (r PreferenceSetWorkflowsPreferenceSetWorkflowCategorySettingObject) ImplementsPreferenceSetWorkflowsUnion()

func (*PreferenceSetWorkflowsPreferenceSetWorkflowCategorySettingObject) UnmarshalJSON

type PreferenceSetWorkflowsUnion

type PreferenceSetWorkflowsUnion interface {
	ImplementsPreferenceSetWorkflowsUnion()
}

Workflow or category preferences within a preference set

Union satisfied by shared.UnionBool or PreferenceSetWorkflowsPreferenceSetWorkflowCategorySettingObject.

type ProviderMsTeamCheckAuthParams

type ProviderMsTeamCheckAuthParams struct {
	// A JSON encoded string containing the Microsoft Teams tenant object reference.
	MsTeamsTenantObject param.Field[string] `query:"ms_teams_tenant_object,required"`
}

func (ProviderMsTeamCheckAuthParams) URLQuery

func (r ProviderMsTeamCheckAuthParams) URLQuery() (v url.Values)

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

type ProviderMsTeamCheckAuthResponse

type ProviderMsTeamCheckAuthResponse struct {
	// A Microsoft Teams connection object.
	Connection ProviderMsTeamCheckAuthResponseConnection `json:"connection,required"`
	JSON       providerMsTeamCheckAuthResponseJSON       `json:"-"`
}

The response from a Microsoft Teams auth check request.

func (*ProviderMsTeamCheckAuthResponse) UnmarshalJSON

func (r *ProviderMsTeamCheckAuthResponse) UnmarshalJSON(data []byte) (err error)

type ProviderMsTeamCheckAuthResponseConnection

type ProviderMsTeamCheckAuthResponseConnection struct {
	// Whether the Microsoft Teams connection is valid.
	Ok bool `json:"ok,required"`
	// The reason for the Microsoft Teams connection if it is not valid.
	Reason string                                        `json:"reason,nullable"`
	JSON   providerMsTeamCheckAuthResponseConnectionJSON `json:"-"`
}

A Microsoft Teams connection object.

func (*ProviderMsTeamCheckAuthResponseConnection) UnmarshalJSON

func (r *ProviderMsTeamCheckAuthResponseConnection) UnmarshalJSON(data []byte) (err error)

type ProviderMsTeamListChannelsParams

type ProviderMsTeamListChannelsParams struct {
	// A JSON encoded string containing the Microsoft Teams tenant object reference.
	MsTeamsTenantObject param.Field[string] `query:"ms_teams_tenant_object,required"`
	// Microsoft Teams team ID.
	TeamID       param.Field[string]                                       `query:"team_id,required"`
	QueryOptions param.Field[ProviderMsTeamListChannelsParamsQueryOptions] `query:"query_options"`
}

func (ProviderMsTeamListChannelsParams) URLQuery

func (r ProviderMsTeamListChannelsParams) URLQuery() (v url.Values)

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

type ProviderMsTeamListChannelsParamsQueryOptions

type ProviderMsTeamListChannelsParamsQueryOptions struct {
	// [OData param](https://learn.microsoft.com/en-us/graph/query-parameters) passed
	// to the Microsoft Graph API to filter channels.
	Filter param.Field[string] `query:"$filter"`
	// [OData param](https://learn.microsoft.com/en-us/graph/query-parameters) passed
	// to the Microsoft Graph API to select specific properties.
	Select param.Field[string] `query:"$select"`
}

func (ProviderMsTeamListChannelsParamsQueryOptions) URLQuery

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

type ProviderMsTeamListChannelsResponse

type ProviderMsTeamListChannelsResponse struct {
	// List of Microsoft Teams channels.
	MsTeamsChannels []ProviderMsTeamListChannelsResponseMsTeamsChannel `json:"ms_teams_channels,required"`
	JSON            providerMsTeamListChannelsResponseJSON             `json:"-"`
}

The response from a Microsoft Teams provider request, containing a list of channels.

func (*ProviderMsTeamListChannelsResponse) UnmarshalJSON

func (r *ProviderMsTeamListChannelsResponse) UnmarshalJSON(data []byte) (err error)

type ProviderMsTeamListChannelsResponseMsTeamsChannel

type ProviderMsTeamListChannelsResponseMsTeamsChannel struct {
	// Microsoft Teams channel ID.
	ID string `json:"id,required"`
	// Microsoft Teams channel name.
	DisplayName string `json:"displayName,required"`
	// Microsoft Teams channel created date and time.
	CreatedDateTime string `json:"createdDateTime"`
	// Microsoft Teams channel description.
	Description string `json:"description,nullable"`
	// Whether the Microsoft Teams channel is archived.
	IsArchived bool `json:"isArchived"`
	// Microsoft Teams channel membership type.
	MembershipType string                                               `json:"membershipType"`
	JSON           providerMsTeamListChannelsResponseMsTeamsChannelJSON `json:"-"`
}

func (*ProviderMsTeamListChannelsResponseMsTeamsChannel) UnmarshalJSON

func (r *ProviderMsTeamListChannelsResponseMsTeamsChannel) UnmarshalJSON(data []byte) (err error)

type ProviderMsTeamListTeamsParams

type ProviderMsTeamListTeamsParams struct {
	// A JSON encoded string containing the Microsoft Teams tenant object reference.
	MsTeamsTenantObject param.Field[string]                                    `query:"ms_teams_tenant_object,required"`
	QueryOptions        param.Field[ProviderMsTeamListTeamsParamsQueryOptions] `query:"query_options"`
}

func (ProviderMsTeamListTeamsParams) URLQuery

func (r ProviderMsTeamListTeamsParams) URLQuery() (v url.Values)

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

type ProviderMsTeamListTeamsParamsQueryOptions

type ProviderMsTeamListTeamsParamsQueryOptions struct {
	// [OData param](https://learn.microsoft.com/en-us/graph/query-parameters) passed
	// to the Microsoft Graph API to filter teams.
	Filter param.Field[string] `query:"$filter"`
	// [OData param](https://learn.microsoft.com/en-us/graph/query-parameters) passed
	// to the Microsoft Graph API to select fields on a team.
	Select param.Field[string] `query:"$select"`
	// [OData param](https://learn.microsoft.com/en-us/graph/query-parameters) passed
	// to the Microsoft Graph API to retrieve the next page of results.
	Skiptoken param.Field[string] `query:"$skiptoken"`
	// [OData param](https://learn.microsoft.com/en-us/graph/query-parameters) passed
	// to the Microsoft Graph API to limit the number of teams returned.
	Top param.Field[int64] `query:"$top"`
}

func (ProviderMsTeamListTeamsParamsQueryOptions) URLQuery

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

type ProviderMsTeamListTeamsResponse

type ProviderMsTeamListTeamsResponse struct {
	// Microsoft Teams team ID.
	ID string `json:"id,required"`
	// Microsoft Teams team display name.
	DisplayName string `json:"displayName,required"`
	// Microsoft Teams team description.
	Description string                              `json:"description,nullable"`
	JSON        providerMsTeamListTeamsResponseJSON `json:"-"`
}

func (*ProviderMsTeamListTeamsResponse) UnmarshalJSON

func (r *ProviderMsTeamListTeamsResponse) UnmarshalJSON(data []byte) (err error)

type ProviderMsTeamRevokeAccessParams

type ProviderMsTeamRevokeAccessParams struct {
	// A JSON encoded string containing the Microsoft Teams tenant object reference.
	MsTeamsTenantObject param.Field[string] `query:"ms_teams_tenant_object,required"`
}

func (ProviderMsTeamRevokeAccessParams) URLQuery

func (r ProviderMsTeamRevokeAccessParams) URLQuery() (v url.Values)

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

type ProviderMsTeamRevokeAccessResponse

type ProviderMsTeamRevokeAccessResponse struct {
	// OK response.
	Ok   string                                 `json:"ok"`
	JSON providerMsTeamRevokeAccessResponseJSON `json:"-"`
}

A response indicating the operation was successful.

func (*ProviderMsTeamRevokeAccessResponse) UnmarshalJSON

func (r *ProviderMsTeamRevokeAccessResponse) UnmarshalJSON(data []byte) (err error)

type ProviderMsTeamService

type ProviderMsTeamService struct {
	Options []option.RequestOption
}

ProviderMsTeamService contains methods and other services that help with interacting with the knock 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 NewProviderMsTeamService method instead.

func NewProviderMsTeamService

func NewProviderMsTeamService(opts ...option.RequestOption) (r *ProviderMsTeamService)

NewProviderMsTeamService 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 (*ProviderMsTeamService) CheckAuth

Check if a connection to Microsoft Teams has been authorized for a given Microsoft Teams tenant object.

func (*ProviderMsTeamService) ListChannels

List the Microsoft Teams channels within a team. By default, archived and private channels are excluded from the results.

func (*ProviderMsTeamService) ListTeams

Get a list of teams belonging to the Microsoft Entra tenant. By default, archived and private channels are excluded from the results.

func (*ProviderMsTeamService) ListTeamsAutoPaging

Get a list of teams belonging to the Microsoft Entra tenant. By default, archived and private channels are excluded from the results.

func (*ProviderMsTeamService) RevokeAccess

Remove a Microsoft Entra tenant ID from a Microsoft Teams tenant object.

type ProviderService

type ProviderService struct {
	Options []option.RequestOption
	Slack   *ProviderSlackService
	MsTeams *ProviderMsTeamService
}

ProviderService contains methods and other services that help with interacting with the knock 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 NewProviderService method instead.

func NewProviderService

func NewProviderService(opts ...option.RequestOption) (r *ProviderService)

NewProviderService 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 ProviderSlackCheckAuthParams

type ProviderSlackCheckAuthParams struct {
	// A JSON encoded string containing the access token object reference.
	AccessTokenObject param.Field[string] `query:"access_token_object,required"`
}

func (ProviderSlackCheckAuthParams) URLQuery

func (r ProviderSlackCheckAuthParams) URLQuery() (v url.Values)

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

type ProviderSlackCheckAuthResponse

type ProviderSlackCheckAuthResponse struct {
	// A Slack connection object.
	Connection ProviderSlackCheckAuthResponseConnection `json:"connection,required"`
	JSON       providerSlackCheckAuthResponseJSON       `json:"-"`
}

The response from a Slack auth check request.

func (*ProviderSlackCheckAuthResponse) UnmarshalJSON

func (r *ProviderSlackCheckAuthResponse) UnmarshalJSON(data []byte) (err error)

type ProviderSlackCheckAuthResponseConnection

type ProviderSlackCheckAuthResponseConnection struct {
	// Whether the Slack connection is valid.
	Ok bool `json:"ok,required"`
	// The reason for the Slack connection if it is not valid.
	Reason string                                       `json:"reason,nullable"`
	JSON   providerSlackCheckAuthResponseConnectionJSON `json:"-"`
}

A Slack connection object.

func (*ProviderSlackCheckAuthResponseConnection) UnmarshalJSON

func (r *ProviderSlackCheckAuthResponseConnection) UnmarshalJSON(data []byte) (err error)

type ProviderSlackListChannelsParams

type ProviderSlackListChannelsParams struct {
	// A JSON encoded string containing the access token object reference.
	AccessTokenObject param.Field[string]                                      `query:"access_token_object,required"`
	QueryOptions      param.Field[ProviderSlackListChannelsParamsQueryOptions] `query:"query_options"`
}

func (ProviderSlackListChannelsParams) URLQuery

func (r ProviderSlackListChannelsParams) URLQuery() (v url.Values)

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

type ProviderSlackListChannelsParamsQueryOptions

type ProviderSlackListChannelsParamsQueryOptions struct {
	// Paginate through collections of data by setting the cursor parameter to a
	// next_cursor attribute returned by a previous request's response_metadata.
	// Default value fetches the first "page" of the collection.
	Cursor param.Field[string] `query:"cursor"`
	// Set to true to exclude archived channels from the list. Defaults to `true` when
	// not explicitly provided.
	ExcludeArchived param.Field[bool] `query:"exclude_archived"`
	// The maximum number of channels to return. Defaults to 200.
	Limit param.Field[int64] `query:"limit"`
	// Encoded team ID (T1234) to list channels in, required if org token is used.
	TeamID param.Field[string] `query:"team_id"`
	// Mix and match channel types by providing a comma-separated list of any
	// combination of public_channel, private_channel, mpim, im. Defaults to
	// `"public_channel,private_channel"`. If the user's Slack ID is unavailable, this
	// option is ignored and only public channels are returned.
	Types param.Field[string] `query:"types"`
}

func (ProviderSlackListChannelsParamsQueryOptions) URLQuery

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

type ProviderSlackListChannelsResponse

type ProviderSlackListChannelsResponse struct {
	// A Slack channel ID from the Slack provider.
	ID string `json:"id,required"`
	// The team ID that the Slack channel belongs to.
	ContextTeamID string `json:"context_team_id,required"`
	// Whether the Slack channel is an IM channel.
	IsIm bool `json:"is_im,required"`
	// Whether the Slack channel is private.
	IsPrivate bool `json:"is_private,required"`
	// Slack channel name.
	Name string                                `json:"name,required"`
	JSON providerSlackListChannelsResponseJSON `json:"-"`
}

A Slack channel.

func (*ProviderSlackListChannelsResponse) UnmarshalJSON

func (r *ProviderSlackListChannelsResponse) UnmarshalJSON(data []byte) (err error)

type ProviderSlackRevokeAccessParams

type ProviderSlackRevokeAccessParams struct {
	// A JSON encoded string containing the access token object reference.
	AccessTokenObject param.Field[string] `query:"access_token_object,required"`
}

func (ProviderSlackRevokeAccessParams) URLQuery

func (r ProviderSlackRevokeAccessParams) URLQuery() (v url.Values)

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

type ProviderSlackRevokeAccessResponse

type ProviderSlackRevokeAccessResponse struct {
	// OK response.
	Ok   string                                `json:"ok"`
	JSON providerSlackRevokeAccessResponseJSON `json:"-"`
}

A response indicating the operation was successful.

func (*ProviderSlackRevokeAccessResponse) UnmarshalJSON

func (r *ProviderSlackRevokeAccessResponse) UnmarshalJSON(data []byte) (err error)

type ProviderSlackService

type ProviderSlackService struct {
	Options []option.RequestOption
}

ProviderSlackService contains methods and other services that help with interacting with the knock 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 NewProviderSlackService method instead.

func NewProviderSlackService

func NewProviderSlackService(opts ...option.RequestOption) (r *ProviderSlackService)

NewProviderSlackService 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 (*ProviderSlackService) CheckAuth

Check if a Slack channel is authenticated.

func (*ProviderSlackService) ListChannels

List Slack channels for a Slack workspace.

func (*ProviderSlackService) ListChannelsAutoPaging

List Slack channels for a Slack workspace.

func (*ProviderSlackService) RevokeAccess

Revoke access for a Slack channel.

type PushChannelData

type PushChannelData struct {
	// A list of push channel tokens.
	Tokens []string            `json:"tokens,required"`
	JSON   pushChannelDataJSON `json:"-"`
}

Push channel data.

func (*PushChannelData) UnmarshalJSON

func (r *PushChannelData) UnmarshalJSON(data []byte) (err error)

type PushChannelDataParam

type PushChannelDataParam struct {
	// A list of push channel tokens.
	Tokens param.Field[[]string] `json:"tokens,required"`
}

Push channel data.

func (PushChannelDataParam) MarshalJSON

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

type Recipient

type Recipient struct {
	// The unique identifier of the user.
	ID string `json:"id,required"`
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The timestamp when the resource was last updated.
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// A URL for the avatar of the user.
	Avatar string `json:"avatar,nullable"`
	// The collection this object belongs to.
	Collection string `json:"collection"`
	// The creation date of the user from your system.
	CreatedAt time.Time `json:"created_at,nullable" format:"date-time"`
	// The primary email address for the user.
	Email string `json:"email,nullable"`
	// Display name of the user.
	Name string `json:"name,nullable"`
	// The [E.164](https://www.twilio.com/docs/glossary/what-e164) phone number of the
	// user (required for SMS channels).
	PhoneNumber string `json:"phone_number,nullable"`
	// This field can have the runtime type of [map[string]interface{}].
	Properties interface{} `json:"properties"`
	// The timezone of the user. Must be a
	// valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
	// Used
	// for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
	Timezone string        `json:"timezone,nullable"`
	JSON     recipientJSON `json:"-"`
	// contains filtered or unexported fields
}

A recipient of a notification, which is either a user or an object.

func (Recipient) AsUnion

func (r Recipient) AsUnion() RecipientUnion

AsUnion returns a RecipientUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are User, Object.

func (*Recipient) UnmarshalJSON

func (r *Recipient) UnmarshalJSON(data []byte) (err error)

type RecipientChannelDataService

type RecipientChannelDataService struct {
	Options []option.RequestOption
}

RecipientChannelDataService contains methods and other services that help with interacting with the knock 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 NewRecipientChannelDataService method instead.

func NewRecipientChannelDataService

func NewRecipientChannelDataService(opts ...option.RequestOption) (r *RecipientChannelDataService)

NewRecipientChannelDataService 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 RecipientPreferenceService

type RecipientPreferenceService struct {
	Options []option.RequestOption
}

RecipientPreferenceService contains methods and other services that help with interacting with the knock 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 NewRecipientPreferenceService method instead.

func NewRecipientPreferenceService

func NewRecipientPreferenceService(opts ...option.RequestOption) (r *RecipientPreferenceService)

NewRecipientPreferenceService 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 RecipientReferenceObjectReference

type RecipientReferenceObjectReference struct {
	// An identifier for the recipient object.
	ID string `json:"id"`
	// The collection the recipient object belongs to.
	Collection string                                `json:"collection"`
	JSON       recipientReferenceObjectReferenceJSON `json:"-"`
}

A reference to a recipient object.

func (RecipientReferenceObjectReference) ImplementsRecipientReferenceUnion

func (r RecipientReferenceObjectReference) ImplementsRecipientReferenceUnion()

func (*RecipientReferenceObjectReference) UnmarshalJSON

func (r *RecipientReferenceObjectReference) UnmarshalJSON(data []byte) (err error)

type RecipientReferenceObjectReferenceParam

type RecipientReferenceObjectReferenceParam struct {
	// An identifier for the recipient object.
	ID param.Field[string] `json:"id"`
	// The collection the recipient object belongs to.
	Collection param.Field[string] `json:"collection"`
}

A reference to a recipient object.

func (RecipientReferenceObjectReferenceParam) ImplementsRecipientReferenceUnionParam

func (r RecipientReferenceObjectReferenceParam) ImplementsRecipientReferenceUnionParam()

func (RecipientReferenceObjectReferenceParam) MarshalJSON

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

type RecipientReferenceUnion

type RecipientReferenceUnion interface {
	ImplementsRecipientReferenceUnion()
}

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

Union satisfied by shared.UnionString or RecipientReferenceObjectReference.

type RecipientReferenceUnionParam

type RecipientReferenceUnionParam interface {
	ImplementsRecipientReferenceUnionParam()
}

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

Satisfied by shared.UnionString, RecipientReferenceObjectReferenceParam.

type RecipientRequestParam

type RecipientRequestParam struct {
	// The unique identifier of the user.
	ID param.Field[string] `json:"id,required"`
	// A URL for the avatar of the user.
	Avatar param.Field[string] `json:"avatar"`
	// A request to set channel data for a type of channel inline.
	ChannelData param.Field[InlineChannelDataRequestParam] `json:"channel_data"`
	// The collection this object belongs to.
	Collection param.Field[string] `json:"collection"`
	// The creation date of the user from your system.
	CreatedAt param.Field[time.Time] `json:"created_at" format:"date-time"`
	// The primary email address for the user.
	Email param.Field[string] `json:"email"`
	// The locale of the user. Used for [message localization](/concepts/translations).
	Locale param.Field[string] `json:"locale"`
	// Display name of the user.
	Name param.Field[string] `json:"name"`
	// The [E.164](https://www.twilio.com/docs/glossary/what-e164) phone number of the
	// user (required for SMS channels).
	PhoneNumber param.Field[string] `json:"phone_number"`
	// Inline set preferences for a recipient, where the key is the preference set id.
	// Preferences that are set inline will be merged into any existing preferences
	// rather than replacing them.
	Preferences param.Field[InlinePreferenceSetRequestParam] `json:"preferences"`
	// The timezone of the user. Must be a
	// valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
	// Used
	// for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
	Timezone param.Field[string] `json:"timezone"`
}

Specifies a recipient in a request. This can either be a user identifier (string), an inline user request (object), or an inline object request, which is determined by the presence of a `collection` property.

func (RecipientRequestParam) ImplementsRecipientRequestUnionParam

func (r RecipientRequestParam) ImplementsRecipientRequestUnionParam()

func (RecipientRequestParam) MarshalJSON

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

type RecipientRequestUnionParam

type RecipientRequestUnionParam interface {
	ImplementsRecipientRequestUnionParam()
}

Specifies a recipient in a request. This can either be a user identifier (string), an inline user request (object), or an inline object request, which is determined by the presence of a `collection` property.

Satisfied by shared.UnionString, InlineIdentifyUserRequestParam, InlineObjectRequestParam, RecipientRequestParam.

type RecipientService

type RecipientService struct {
	Options       []option.RequestOption
	Subscriptions *RecipientSubscriptionService
	Preferences   *RecipientPreferenceService
	ChannelData   *RecipientChannelDataService
}

RecipientService contains methods and other services that help with interacting with the knock 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 NewRecipientService method instead.

func NewRecipientService

func NewRecipientService(opts ...option.RequestOption) (r *RecipientService)

NewRecipientService 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 RecipientSubscriptionService

type RecipientSubscriptionService struct {
	Options []option.RequestOption
}

RecipientSubscriptionService contains methods and other services that help with interacting with the knock 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 NewRecipientSubscriptionService method instead.

func NewRecipientSubscriptionService

func NewRecipientSubscriptionService(opts ...option.RequestOption) (r *RecipientSubscriptionService)

NewRecipientSubscriptionService 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 RecipientUnion

type RecipientUnion interface {
	// contains filtered or unexported methods
}

A recipient of a notification, which is either a user or an object.

Union satisfied by User or Object.

type Schedule

type Schedule struct {
	// Unique identifier for the schedule.
	ID string `json:"id,required" format:"uuid"`
	// Timestamp when the resource was created.
	InsertedAt time.Time `json:"inserted_at,required" format:"date-time"`
	// A recipient of a notification, which is either a user or an object.
	Recipient Recipient `json:"recipient,required"`
	// The repeat rule for the schedule.
	Repeats []ScheduleRepeatRule `json:"repeats,required"`
	// The timestamp when the resource was last updated.
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// The workflow the schedule is applied to.
	Workflow string `json:"workflow,required"`
	// The typename of the schema.
	Typename string `json:"__typename"`
	// A recipient of a notification, which is either a user or an object.
	Actor Recipient `json:"actor,nullable"`
	// An optional map of data to pass into the workflow execution. There is a 10MB
	// limit on the size of the full `data` payload. Any individual string value
	// greater than 1024 bytes in length will be
	// [truncated](/developer-tools/api-logs#log-truncation) in your logs.
	Data map[string]interface{} `json:"data,nullable"`
	// The last occurrence of the schedule.
	LastOccurrenceAt time.Time `json:"last_occurrence_at,nullable" format:"date-time"`
	// The next occurrence of the schedule.
	NextOccurrenceAt time.Time `json:"next_occurrence_at,nullable" format:"date-time"`
	// The tenant to trigger the workflow for. Triggering with a tenant will use any
	// tenant-level overrides associated with the tenant object, and all messages
	// produced from workflow runs will be tagged with the tenant.
	Tenant string       `json:"tenant,nullable"`
	JSON   scheduleJSON `json:"-"`
}

A schedule represents a recurring workflow execution.

func (*Schedule) UnmarshalJSON

func (r *Schedule) UnmarshalJSON(data []byte) (err error)

type ScheduleBulkNewParams

type ScheduleBulkNewParams struct {
	// A list of schedules.
	Schedules param.Field[[]ScheduleBulkNewParamsSchedule] `json:"schedules,required"`
}

func (ScheduleBulkNewParams) MarshalJSON

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

type ScheduleBulkNewParamsSchedule

type ScheduleBulkNewParamsSchedule struct {
	// The key of the workflow.
	Workflow param.Field[string] `json:"workflow,required"`
	// Specifies a recipient in a request. This can either be a user identifier
	// (string), an inline user request (object), or an inline object request, which is
	// determined by the presence of a `collection` property.
	Actor param.Field[RecipientRequestUnionParam] `json:"actor"`
	// An optional map of data to pass into the workflow execution. There is a 10MB
	// limit on the size of the full `data` payload. Any individual string value
	// greater than 1024 bytes in length will be
	// [truncated](/developer-tools/api-logs#log-truncation) in your logs.
	Data param.Field[map[string]interface{}] `json:"data"`
	// The ending date and time for the schedule.
	EndingAt param.Field[time.Time] `json:"ending_at" format:"date-time"`
	// Specifies a recipient in a request. This can either be a user identifier
	// (string), an inline user request (object), or an inline object request, which is
	// determined by the presence of a `collection` property.
	Recipient param.Field[RecipientRequestUnionParam] `json:"recipient"`
	// The repeat rule for the schedule.
	Repeats param.Field[[]ScheduleRepeatRuleParam] `json:"repeats"`
	// The starting date and time for the schedule.
	ScheduledAt param.Field[time.Time] `json:"scheduled_at" format:"date-time"`
	// An request to set a tenant inline.
	Tenant param.Field[InlineTenantRequestUnionParam] `json:"tenant"`
}

A schedule represents a recurring workflow execution.

func (ScheduleBulkNewParamsSchedule) MarshalJSON

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

type ScheduleBulkService

type ScheduleBulkService struct {
	Options []option.RequestOption
}

ScheduleBulkService contains methods and other services that help with interacting with the knock 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 NewScheduleBulkService method instead.

func NewScheduleBulkService

func NewScheduleBulkService(opts ...option.RequestOption) (r *ScheduleBulkService)

NewScheduleBulkService 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 (*ScheduleBulkService) New

Bulk creates up to 1,000 schedules at a time. This endpoint also handles [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients) for the `actor`, `recipient`, and `tenant` fields.

type ScheduleDeleteParams

type ScheduleDeleteParams struct {
	// A list of schedule IDs.
	ScheduleIDs param.Field[[]string] `json:"schedule_ids,required"`
}

func (ScheduleDeleteParams) MarshalJSON

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

type ScheduleListParams

type ScheduleListParams struct {
	// Filter by workflow key.
	Workflow param.Field[string] `query:"workflow,required"`
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
	// Filter by recipient references.
	Recipients param.Field[[]RecipientReferenceUnionParam] `query:"recipients"`
	// Filter by tenant ID.
	Tenant param.Field[string] `query:"tenant"`
}

func (ScheduleListParams) URLQuery

func (r ScheduleListParams) URLQuery() (v url.Values)

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

type ScheduleNewParams

type ScheduleNewParams struct {
	// The recipients to set the schedule for. Limited to 100 recipients per request.
	Recipients param.Field[[]RecipientRequestUnionParam] `json:"recipients,required"`
	// The key of the workflow.
	Workflow param.Field[string] `json:"workflow,required"`
	// Specifies a recipient in a request. This can either be a user identifier
	// (string), an inline user request (object), or an inline object request, which is
	// determined by the presence of a `collection` property.
	Actor param.Field[RecipientRequestUnionParam] `json:"actor"`
	// An optional map of data to pass into the workflow execution. There is a 10MB
	// limit on the size of the full `data` payload. Any individual string value
	// greater than 1024 bytes in length will be
	// [truncated](/developer-tools/api-logs#log-truncation) in your logs.
	Data param.Field[map[string]interface{}] `json:"data"`
	// The ending date and time for the schedule.
	EndingAt param.Field[time.Time] `json:"ending_at" format:"date-time"`
	// The repeat rule for the schedule.
	Repeats param.Field[[]ScheduleRepeatRuleParam] `json:"repeats"`
	// The starting date and time for the schedule.
	ScheduledAt param.Field[time.Time] `json:"scheduled_at" format:"date-time"`
	// An request to set a tenant inline.
	Tenant param.Field[InlineTenantRequestUnionParam] `json:"tenant"`
}

func (ScheduleNewParams) MarshalJSON

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

type ScheduleRepeatRule

type ScheduleRepeatRule struct {
	// The frequency of the schedule.
	Frequency ScheduleRepeatRuleFrequency `json:"frequency,required"`
	// The typename of the schema.
	Typename string `json:"__typename"`
	// The day of the month to repeat the schedule.
	DayOfMonth int64 `json:"day_of_month,nullable"`
	// The days of the week to repeat the schedule.
	Days []ScheduleRepeatRuleDay `json:"days,nullable"`
	// The hour of the day to repeat the schedule.
	Hours int64 `json:"hours,nullable"`
	// The interval of the schedule.
	Interval int64 `json:"interval"`
	// The minute of the hour to repeat the schedule.
	Minutes int64                  `json:"minutes,nullable"`
	JSON    scheduleRepeatRuleJSON `json:"-"`
}

The repeat rule for the schedule.

func (*ScheduleRepeatRule) UnmarshalJSON

func (r *ScheduleRepeatRule) UnmarshalJSON(data []byte) (err error)

type ScheduleRepeatRuleDay

type ScheduleRepeatRuleDay string

An identifier for a day of the week.

const (
	ScheduleRepeatRuleDayMon ScheduleRepeatRuleDay = "mon"
	ScheduleRepeatRuleDayTue ScheduleRepeatRuleDay = "tue"
	ScheduleRepeatRuleDayWed ScheduleRepeatRuleDay = "wed"
	ScheduleRepeatRuleDayThu ScheduleRepeatRuleDay = "thu"
	ScheduleRepeatRuleDayFri ScheduleRepeatRuleDay = "fri"
	ScheduleRepeatRuleDaySat ScheduleRepeatRuleDay = "sat"
	ScheduleRepeatRuleDaySun ScheduleRepeatRuleDay = "sun"
)

func (ScheduleRepeatRuleDay) IsKnown

func (r ScheduleRepeatRuleDay) IsKnown() bool

type ScheduleRepeatRuleFrequency

type ScheduleRepeatRuleFrequency string

The frequency of the schedule.

const (
	ScheduleRepeatRuleFrequencyDaily   ScheduleRepeatRuleFrequency = "daily"
	ScheduleRepeatRuleFrequencyWeekly  ScheduleRepeatRuleFrequency = "weekly"
	ScheduleRepeatRuleFrequencyMonthly ScheduleRepeatRuleFrequency = "monthly"
	ScheduleRepeatRuleFrequencyHourly  ScheduleRepeatRuleFrequency = "hourly"
)

func (ScheduleRepeatRuleFrequency) IsKnown

func (r ScheduleRepeatRuleFrequency) IsKnown() bool

type ScheduleRepeatRuleParam

type ScheduleRepeatRuleParam struct {
	// The frequency of the schedule.
	Frequency param.Field[ScheduleRepeatRuleFrequency] `json:"frequency,required"`
	// The typename of the schema.
	Typename param.Field[string] `json:"__typename"`
	// The day of the month to repeat the schedule.
	DayOfMonth param.Field[int64] `json:"day_of_month"`
	// The days of the week to repeat the schedule.
	Days param.Field[[]ScheduleRepeatRuleDay] `json:"days"`
	// The hour of the day to repeat the schedule.
	Hours param.Field[int64] `json:"hours"`
	// The interval of the schedule.
	Interval param.Field[int64] `json:"interval"`
	// The minute of the hour to repeat the schedule.
	Minutes param.Field[int64] `json:"minutes"`
}

The repeat rule for the schedule.

func (ScheduleRepeatRuleParam) MarshalJSON

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

type ScheduleService

type ScheduleService struct {
	Options []option.RequestOption
	Bulk    *ScheduleBulkService
}

ScheduleService contains methods and other services that help with interacting with the knock 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 NewScheduleService method instead.

func NewScheduleService

func NewScheduleService(opts ...option.RequestOption) (r *ScheduleService)

NewScheduleService 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 (*ScheduleService) Delete

func (r *ScheduleService) Delete(ctx context.Context, body ScheduleDeleteParams, opts ...option.RequestOption) (res *[]Schedule, err error)

Permanently deletes one or more schedules identified by the provided schedule IDs. This operation cannot be undone.

func (*ScheduleService) List

Returns a paginated list of schedules for the current environment, filtered by workflow and optionally by recipients and tenant.

func (*ScheduleService) ListAutoPaging

Returns a paginated list of schedules for the current environment, filtered by workflow and optionally by recipients and tenant.

func (*ScheduleService) New

func (r *ScheduleService) New(ctx context.Context, body ScheduleNewParams, opts ...option.RequestOption) (res *[]Schedule, err error)

Creates one or more schedules for a workflow with the specified recipients, timing, and data. Schedules can be one-time or recurring. This endpoint also handles [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients) for the `actor`, `recipient`, and `tenant` fields.

func (*ScheduleService) Update

func (r *ScheduleService) Update(ctx context.Context, body ScheduleUpdateParams, opts ...option.RequestOption) (res *[]Schedule, err error)

Updates one or more existing schedules with new timing, data, or other properties. All specified schedule IDs will be updated with the same values. This endpoint also handles [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients) for the `actor`, `recipient`, and `tenant` fields.

type ScheduleUpdateParams

type ScheduleUpdateParams struct {
	// A list of schedule IDs.
	ScheduleIDs param.Field[[]string] `json:"schedule_ids,required" format:"uuid"`
	// A reference to a recipient, either a user identifier (string) or an object
	// reference (ID, collection).
	Actor param.Field[RecipientReferenceUnionParam] `json:"actor"`
	// An optional map of data to pass into the workflow execution. There is a 10MB
	// limit on the size of the full `data` payload. Any individual string value
	// greater than 1024 bytes in length will be
	// [truncated](/developer-tools/api-logs#log-truncation) in your logs.
	Data param.Field[map[string]interface{}] `json:"data"`
	// The ending date and time for the schedule.
	EndingAt param.Field[time.Time] `json:"ending_at" format:"date-time"`
	// The repeat rule for the schedule.
	Repeats param.Field[[]ScheduleRepeatRuleParam] `json:"repeats"`
	// The starting date and time for the schedule.
	ScheduledAt param.Field[time.Time] `json:"scheduled_at" format:"date-time"`
	// An request to set a tenant inline.
	Tenant param.Field[InlineTenantRequestUnionParam] `json:"tenant"`
}

func (ScheduleUpdateParams) MarshalJSON

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

type SharedService

type SharedService struct {
	Options []option.RequestOption
}

SharedService contains methods and other services that help with interacting with the knock 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 NewSharedService method instead.

func NewSharedService

func NewSharedService(opts ...option.RequestOption) (r *SharedService)

NewSharedService 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 SlackChannelData

type SlackChannelData struct {
	// List of Slack channel connections.
	Connections []SlackChannelDataConnection `json:"connections,required"`
	// A Slack connection token.
	Token SlackChannelDataToken `json:"token,nullable"`
	JSON  slackChannelDataJSON  `json:"-"`
}

Slack channel data.

func (*SlackChannelData) UnmarshalJSON

func (r *SlackChannelData) UnmarshalJSON(data []byte) (err error)

type SlackChannelDataConnection

type SlackChannelDataConnection struct {
	// A Slack access token.
	AccessToken string `json:"access_token,nullable"`
	// A Slack channel ID from the Slack provider.
	ChannelID string `json:"channel_id,nullable"`
	// The URL of the incoming webhook for a Slack connection.
	URL string `json:"url"`
	// A Slack user ID from the Slack provider.
	UserID string                         `json:"user_id,nullable"`
	JSON   slackChannelDataConnectionJSON `json:"-"`
	// contains filtered or unexported fields
}

A Slack connection, either an access token or an incoming webhook

func (SlackChannelDataConnection) AsUnion

AsUnion returns a SlackChannelDataConnectionsUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are SlackChannelDataConnectionsSlackTokenConnection, SlackChannelDataConnectionsSlackIncomingWebhookConnection.

func (*SlackChannelDataConnection) UnmarshalJSON

func (r *SlackChannelDataConnection) UnmarshalJSON(data []byte) (err error)

type SlackChannelDataConnectionParam

type SlackChannelDataConnectionParam struct {
	// A Slack access token.
	AccessToken param.Field[string] `json:"access_token"`
	// A Slack channel ID from the Slack provider.
	ChannelID param.Field[string] `json:"channel_id"`
	// The URL of the incoming webhook for a Slack connection.
	URL param.Field[string] `json:"url"`
	// A Slack user ID from the Slack provider.
	UserID param.Field[string] `json:"user_id"`
}

A Slack connection, either an access token or an incoming webhook

func (SlackChannelDataConnectionParam) MarshalJSON

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

type SlackChannelDataConnectionsSlackIncomingWebhookConnection

type SlackChannelDataConnectionsSlackIncomingWebhookConnection struct {
	// The URL of the incoming webhook for a Slack connection.
	URL  string                                                        `json:"url,required"`
	JSON slackChannelDataConnectionsSlackIncomingWebhookConnectionJSON `json:"-"`
}

A Slack connection incoming webhook.

func (*SlackChannelDataConnectionsSlackIncomingWebhookConnection) UnmarshalJSON

type SlackChannelDataConnectionsSlackIncomingWebhookConnectionParam

type SlackChannelDataConnectionsSlackIncomingWebhookConnectionParam struct {
	// The URL of the incoming webhook for a Slack connection.
	URL param.Field[string] `json:"url,required"`
}

A Slack connection incoming webhook.

func (SlackChannelDataConnectionsSlackIncomingWebhookConnectionParam) MarshalJSON

type SlackChannelDataConnectionsSlackTokenConnection

type SlackChannelDataConnectionsSlackTokenConnection struct {
	// A Slack access token.
	AccessToken string `json:"access_token,nullable"`
	// A Slack channel ID from the Slack provider.
	ChannelID string `json:"channel_id,nullable"`
	// A Slack user ID from the Slack provider.
	UserID string                                              `json:"user_id,nullable"`
	JSON   slackChannelDataConnectionsSlackTokenConnectionJSON `json:"-"`
}

A Slack connection token.

func (*SlackChannelDataConnectionsSlackTokenConnection) UnmarshalJSON

func (r *SlackChannelDataConnectionsSlackTokenConnection) UnmarshalJSON(data []byte) (err error)

type SlackChannelDataConnectionsSlackTokenConnectionParam

type SlackChannelDataConnectionsSlackTokenConnectionParam struct {
	// A Slack access token.
	AccessToken param.Field[string] `json:"access_token"`
	// A Slack channel ID from the Slack provider.
	ChannelID param.Field[string] `json:"channel_id"`
	// A Slack user ID from the Slack provider.
	UserID param.Field[string] `json:"user_id"`
}

A Slack connection token.

func (SlackChannelDataConnectionsSlackTokenConnectionParam) MarshalJSON

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

type SlackChannelDataConnectionsUnion

type SlackChannelDataConnectionsUnion interface {
	// contains filtered or unexported methods
}

A Slack connection, either an access token or an incoming webhook

Union satisfied by SlackChannelDataConnectionsSlackTokenConnection or SlackChannelDataConnectionsSlackIncomingWebhookConnection.

type SlackChannelDataConnectionsUnionParam

type SlackChannelDataConnectionsUnionParam interface {
	// contains filtered or unexported methods
}

A Slack connection, either an access token or an incoming webhook

Satisfied by SlackChannelDataConnectionsSlackTokenConnectionParam, SlackChannelDataConnectionsSlackIncomingWebhookConnectionParam, SlackChannelDataConnectionParam.

type SlackChannelDataParam

type SlackChannelDataParam struct {
	// List of Slack channel connections.
	Connections param.Field[[]SlackChannelDataConnectionsUnionParam] `json:"connections,required"`
	// A Slack connection token.
	Token param.Field[SlackChannelDataTokenParam] `json:"token"`
}

Slack channel data.

func (SlackChannelDataParam) MarshalJSON

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

type SlackChannelDataToken

type SlackChannelDataToken struct {
	// A Slack access token.
	AccessToken string                    `json:"access_token,required,nullable"`
	JSON        slackChannelDataTokenJSON `json:"-"`
}

A Slack connection token.

func (*SlackChannelDataToken) UnmarshalJSON

func (r *SlackChannelDataToken) UnmarshalJSON(data []byte) (err error)

type SlackChannelDataTokenParam

type SlackChannelDataTokenParam struct {
	// A Slack access token.
	AccessToken param.Field[string] `json:"access_token,required"`
}

A Slack connection token.

func (SlackChannelDataTokenParam) MarshalJSON

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

type Subscription

type Subscription struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// Timestamp when the resource was created.
	InsertedAt time.Time `json:"inserted_at,required" format:"date-time"`
	// A custom [Object](/concepts/objects) entity which belongs to a collection.
	Object Object `json:"object,required"`
	// A recipient of a notification, which is either a user or an object.
	Recipient Recipient `json:"recipient,required"`
	// The timestamp when the resource was last updated.
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// The custom properties associated with the subscription relationship.
	Properties map[string]interface{} `json:"properties,nullable"`
	JSON       subscriptionJSON       `json:"-"`
}

A subscription object.

func (*Subscription) UnmarshalJSON

func (r *Subscription) UnmarshalJSON(data []byte) (err error)

type Tenant

type Tenant struct {
	// The unique identifier for the tenant.
	ID string `json:"id,required"`
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// An optional name for the tenant.
	Name string `json:"name,nullable"`
	// The settings for the tenant. Includes branding and preference set.
	Settings    TenantSettings         `json:"settings,nullable"`
	ExtraFields map[string]interface{} `json:"-,extras"`
	JSON        tenantJSON             `json:"-"`
}

A tenant entity.

func (*Tenant) UnmarshalJSON

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

type TenantBulkDeleteParams

type TenantBulkDeleteParams struct {
	// The IDs of the tenants to delete.
	TenantIDs param.Field[[]string] `query:"tenant_ids,required"`
}

func (TenantBulkDeleteParams) URLQuery

func (r TenantBulkDeleteParams) URLQuery() (v url.Values)

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

type TenantBulkService

type TenantBulkService struct {
	Options []option.RequestOption
}

TenantBulkService contains methods and other services that help with interacting with the knock 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 NewTenantBulkService method instead.

func NewTenantBulkService

func NewTenantBulkService(opts ...option.RequestOption) (r *TenantBulkService)

NewTenantBulkService 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 (*TenantBulkService) Delete

Delete multiple tenants in a single operation. This operation cannot be undone.

func (*TenantBulkService) Set

Set or update up to 1,000 tenants in a single operation.

type TenantBulkSetParams

type TenantBulkSetParams struct {
	// The tenants to be upserted.
	Tenants param.Field[[]InlineTenantRequestUnionParam] `json:"tenants,required"`
}

func (TenantBulkSetParams) MarshalJSON

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

type TenantListParams

type TenantListParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// Filter tenants by name.
	Name param.Field[string] `query:"name"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
	// Filter tenants by ID.
	TenantID param.Field[string] `query:"tenant_id"`
}

func (TenantListParams) URLQuery

func (r TenantListParams) URLQuery() (v url.Values)

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

type TenantRequestParam

type TenantRequestParam struct {
	// The unique identifier for the tenant.
	ID param.Field[string] `json:"id,required"`
	// A request to set channel data for a type of channel inline.
	ChannelData param.Field[InlineChannelDataRequestParam] `json:"channel_data"`
	// Inline set preferences for a recipient, where the key is the preference set id.
	// Preferences that are set inline will be merged into any existing preferences
	// rather than replacing them.
	Preferences param.Field[InlinePreferenceSetRequestParam] `json:"preferences"`
	// The settings for the tenant. Includes branding and preference set.
	Settings    param.Field[TenantRequestSettingsParam] `json:"settings"`
	ExtraFields map[string]interface{}                  `json:"-,extras"`
}

A tenant to be set in the system. You can supply any additional properties on the tenant object.

func (TenantRequestParam) ImplementsInlineTenantRequestUnionParam

func (r TenantRequestParam) ImplementsInlineTenantRequestUnionParam()

func (TenantRequestParam) MarshalJSON

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

type TenantRequestSettingsBrandingParam

type TenantRequestSettingsBrandingParam struct {
	// The icon URL for the tenant. Must point to a valid image with an image MIME
	// type.
	IconURL param.Field[string] `json:"icon_url"`
	// The logo URL for the tenant. Must point to a valid image with an image MIME
	// type.
	LogoURL param.Field[string] `json:"logo_url"`
	// The primary color for the tenant, provided as a hex value.
	PrimaryColor param.Field[string] `json:"primary_color"`
	// The primary color contrast for the tenant, provided as a hex value.
	PrimaryColorContrast param.Field[string] `json:"primary_color_contrast"`
}

The branding for the tenant.

func (TenantRequestSettingsBrandingParam) MarshalJSON

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

type TenantRequestSettingsParam

type TenantRequestSettingsParam struct {
	// The branding for the tenant.
	Branding param.Field[TenantRequestSettingsBrandingParam] `json:"branding"`
	// A request to set a preference set for a recipient.
	PreferenceSet param.Field[PreferenceSetRequestParam] `json:"preference_set"`
}

The settings for the tenant. Includes branding and preference set.

func (TenantRequestSettingsParam) MarshalJSON

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

type TenantService

type TenantService struct {
	Options []option.RequestOption
	Bulk    *TenantBulkService
}

TenantService contains methods and other services that help with interacting with the knock 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

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

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

Delete a tenant and all associated data. This operation cannot be undone.

func (*TenantService) Get

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

Get a tenant by ID.

func (*TenantService) List

List tenants for the current environment.

func (*TenantService) ListAutoPaging

List tenants for the current environment.

func (*TenantService) Set

func (r *TenantService) Set(ctx context.Context, id string, body TenantSetParams, opts ...option.RequestOption) (res *Tenant, err error)

Sets a tenant within an environment, performing an upsert operation. Any existing properties will be merged with the incoming properties.

type TenantSetParams

type TenantSetParams struct {
	// A request to set channel data for a type of channel inline.
	ChannelData param.Field[InlineChannelDataRequestParam] `json:"channel_data"`
	// The settings for the tenant. Includes branding and preference set.
	Settings param.Field[TenantSetParamsSettings] `json:"settings"`
}

func (TenantSetParams) MarshalJSON

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

type TenantSetParamsSettings

type TenantSetParamsSettings struct {
	// The branding for the tenant.
	Branding param.Field[TenantSetParamsSettingsBranding] `json:"branding"`
	// A request to set a preference set for a recipient.
	PreferenceSet param.Field[PreferenceSetRequestParam] `json:"preference_set"`
}

The settings for the tenant. Includes branding and preference set.

func (TenantSetParamsSettings) MarshalJSON

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

type TenantSetParamsSettingsBranding

type TenantSetParamsSettingsBranding struct {
	// The icon URL for the tenant. Must point to a valid image with an image MIME
	// type.
	IconURL param.Field[string] `json:"icon_url"`
	// The logo URL for the tenant. Must point to a valid image with an image MIME
	// type.
	LogoURL param.Field[string] `json:"logo_url"`
	// The primary color for the tenant, provided as a hex value.
	PrimaryColor param.Field[string] `json:"primary_color"`
	// The primary color contrast for the tenant, provided as a hex value.
	PrimaryColorContrast param.Field[string] `json:"primary_color_contrast"`
}

The branding for the tenant.

func (TenantSetParamsSettingsBranding) MarshalJSON

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

type TenantSettings

type TenantSettings struct {
	// The branding for the tenant.
	Branding TenantSettingsBranding `json:"branding,nullable"`
	// A preference set represents a specific set of notification preferences for a
	// recipient. A recipient can have multiple preference sets.
	PreferenceSet PreferenceSet      `json:"preference_set,nullable"`
	JSON          tenantSettingsJSON `json:"-"`
}

The settings for the tenant. Includes branding and preference set.

func (*TenantSettings) UnmarshalJSON

func (r *TenantSettings) UnmarshalJSON(data []byte) (err error)

type TenantSettingsBranding

type TenantSettingsBranding struct {
	// The icon URL for the tenant. Must point to a valid image with an image MIME
	// type.
	IconURL string `json:"icon_url,nullable" format:"uri"`
	// The logo URL for the tenant. Must point to a valid image with an image MIME
	// type.
	LogoURL string `json:"logo_url,nullable" format:"uri"`
	// The primary color for the tenant, provided as a hex value.
	PrimaryColor string `json:"primary_color,nullable"`
	// The primary color contrast for the tenant, provided as a hex value.
	PrimaryColorContrast string                     `json:"primary_color_contrast,nullable"`
	JSON                 tenantSettingsBrandingJSON `json:"-"`
}

The branding for the tenant.

func (*TenantSettingsBranding) UnmarshalJSON

func (r *TenantSettingsBranding) UnmarshalJSON(data []byte) (err error)

type User

type User struct {
	// The unique identifier of the user.
	ID string `json:"id,required"`
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// The timestamp when the resource was last updated.
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// A URL for the avatar of the user.
	Avatar string `json:"avatar,nullable"`
	// The creation date of the user from your system.
	CreatedAt time.Time `json:"created_at,nullable" format:"date-time"`
	// The primary email address for the user.
	Email string `json:"email,nullable"`
	// Display name of the user.
	Name string `json:"name,nullable"`
	// The [E.164](https://www.twilio.com/docs/glossary/what-e164) phone number of the
	// user (required for SMS channels).
	PhoneNumber string `json:"phone_number,nullable"`
	// The timezone of the user. Must be a
	// valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
	// Used
	// for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
	Timezone    string                 `json:"timezone,nullable"`
	ExtraFields map[string]interface{} `json:"-,extras"`
	JSON        userJSON               `json:"-"`
}

A User(/concepts/users) represents an individual in your system who can receive notifications through Knock. Users are the most common recipients of notifications and are always referenced by your internal identifier.

func (*User) UnmarshalJSON

func (r *User) UnmarshalJSON(data []byte) (err error)

type UserBulkDeleteParams

type UserBulkDeleteParams struct {
	// A list of user IDs.
	UserIDs param.Field[[]string] `json:"user_ids,required"`
}

func (UserBulkDeleteParams) MarshalJSON

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

type UserBulkIdentifyParams

type UserBulkIdentifyParams struct {
	// A list of users.
	Users param.Field[[]InlineIdentifyUserRequestParam] `json:"users,required"`
}

func (UserBulkIdentifyParams) MarshalJSON

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

type UserBulkService

type UserBulkService struct {
	Options []option.RequestOption
}

UserBulkService contains methods and other services that help with interacting with the knock 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 NewUserBulkService method instead.

func NewUserBulkService

func NewUserBulkService(opts ...option.RequestOption) (r *UserBulkService)

NewUserBulkService 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 (*UserBulkService) Delete

func (r *UserBulkService) Delete(ctx context.Context, body UserBulkDeleteParams, opts ...option.RequestOption) (res *BulkOperation, err error)

Permanently deletes up to 1,000 users at a time.

func (*UserBulkService) Identify

func (r *UserBulkService) Identify(ctx context.Context, body UserBulkIdentifyParams, opts ...option.RequestOption) (res *BulkOperation, err error)

Identifies multiple users in a single operation. Allows creating or updating up to 1,000 users in a single batch with various properties, preferences, and channel data.

func (*UserBulkService) SetPreferences

func (r *UserBulkService) SetPreferences(ctx context.Context, body UserBulkSetPreferencesParams, opts ...option.RequestOption) (res *BulkOperation, err error)

Bulk sets the preferences for up to 1,000 users at a time. The preference set `:id` can be either `default` or a `tenant.id`. Learn more about [per-tenant preferences](/preferences/tenant-preferences). Note that this is a destructive operation and will replace any existing users' preferences with the preferences sent.

type UserBulkSetPreferencesParams

type UserBulkSetPreferencesParams struct {
	// A request to set a preference set for a recipient.
	Preferences param.Field[PreferenceSetRequestParam] `json:"preferences,required"`
	// A list of user IDs.
	UserIDs param.Field[[]string] `json:"user_ids,required"`
}

func (UserBulkSetPreferencesParams) MarshalJSON

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

type UserFeedGetSettingsResponse

type UserFeedGetSettingsResponse struct {
	// Features configuration for the user's feed.
	Features UserFeedGetSettingsResponseFeatures `json:"features,required"`
	JSON     userFeedGetSettingsResponseJSON     `json:"-"`
}

The response for the user's feed settings.

func (*UserFeedGetSettingsResponse) UnmarshalJSON

func (r *UserFeedGetSettingsResponse) UnmarshalJSON(data []byte) (err error)

type UserFeedGetSettingsResponseFeatures

type UserFeedGetSettingsResponseFeatures struct {
	// Whether branding is required for the user's feed.
	BrandingRequired bool                                    `json:"branding_required,required"`
	JSON             userFeedGetSettingsResponseFeaturesJSON `json:"-"`
}

Features configuration for the user's feed.

func (*UserFeedGetSettingsResponseFeatures) UnmarshalJSON

func (r *UserFeedGetSettingsResponseFeatures) UnmarshalJSON(data []byte) (err error)

type UserFeedListItemsParams

type UserFeedListItemsParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The archived status of the feed items.
	Archived param.Field[UserFeedListItemsParamsArchived] `query:"archived"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// Whether the feed items have a tenant.
	HasTenant param.Field[bool] `query:"has_tenant"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
	// The workflow key associated with the message in the feed.
	Source param.Field[string] `query:"source"`
	// The status of the feed items.
	Status param.Field[UserFeedListItemsParamsStatus] `query:"status"`
	// The tenant associated with the feed items.
	Tenant param.Field[string] `query:"tenant"`
	// The trigger data of the feed items (as a JSON string).
	TriggerData param.Field[string] `query:"trigger_data"`
	// The workflow categories of the feed items.
	WorkflowCategories param.Field[[]string] `query:"workflow_categories"`
}

func (UserFeedListItemsParams) URLQuery

func (r UserFeedListItemsParams) URLQuery() (v url.Values)

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

type UserFeedListItemsParamsArchived

type UserFeedListItemsParamsArchived string

The archived status of the feed items.

const (
	UserFeedListItemsParamsArchivedExclude UserFeedListItemsParamsArchived = "exclude"
	UserFeedListItemsParamsArchivedInclude UserFeedListItemsParamsArchived = "include"
	UserFeedListItemsParamsArchivedOnly    UserFeedListItemsParamsArchived = "only"
)

func (UserFeedListItemsParamsArchived) IsKnown

type UserFeedListItemsParamsStatus

type UserFeedListItemsParamsStatus string

The status of the feed items.

const (
	UserFeedListItemsParamsStatusUnread UserFeedListItemsParamsStatus = "unread"
	UserFeedListItemsParamsStatusRead   UserFeedListItemsParamsStatus = "read"
	UserFeedListItemsParamsStatusUnseen UserFeedListItemsParamsStatus = "unseen"
	UserFeedListItemsParamsStatusSeen   UserFeedListItemsParamsStatus = "seen"
	UserFeedListItemsParamsStatusAll    UserFeedListItemsParamsStatus = "all"
)

func (UserFeedListItemsParamsStatus) IsKnown

func (r UserFeedListItemsParamsStatus) IsKnown() bool

type UserFeedListItemsResponse

type UserFeedListItemsResponse struct {
	// Unique identifier for the feed.
	ID string `json:"id,required"`
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// List of activities associated with this feed item.
	Activities []Activity `json:"activities,required"`
	// List of actors associated with this feed item.
	Actors []Recipient `json:"actors,required"`
	// Content blocks that make up the feed item.
	Blocks []UserFeedListItemsResponseBlock `json:"blocks,required"`
	// Additional data associated with the feed item.
	Data map[string]interface{} `json:"data,required,nullable"`
	// Timestamp when the resource was created.
	InsertedAt string `json:"inserted_at,required"`
	// Source information for the feed item.
	Source UserFeedListItemsResponseSource `json:"source,required"`
	// Tenant ID that the feed item belongs to.
	Tenant string `json:"tenant,required,nullable"`
	// Total number of activities related to this feed item.
	TotalActivities int64 `json:"total_activities,required"`
	// Total number of actors related to this feed item.
	TotalActors int64 `json:"total_actors,required"`
	// The timestamp when the resource was last updated.
	UpdatedAt string `json:"updated_at,required"`
	// Timestamp when the feed item was archived.
	ArchivedAt string `json:"archived_at,nullable"`
	// Timestamp when the feed item was clicked.
	ClickedAt string `json:"clicked_at,nullable"`
	// Timestamp when the feed item was interacted with.
	InteractedAt string `json:"interacted_at,nullable"`
	// Timestamp when a link within the feed item was clicked.
	LinkClickedAt string `json:"link_clicked_at,nullable"`
	// Timestamp when the feed item was marked as read.
	ReadAt string `json:"read_at,nullable"`
	// Timestamp when the feed item was marked as seen.
	SeenAt string                        `json:"seen_at,nullable"`
	JSON   userFeedListItemsResponseJSON `json:"-"`
}

An in-app feed message in a user's feed.

func (*UserFeedListItemsResponse) UnmarshalJSON

func (r *UserFeedListItemsResponse) UnmarshalJSON(data []byte) (err error)

type UserFeedListItemsResponseBlock

type UserFeedListItemsResponseBlock struct {
	// The name of the block in a message in an app feed.
	Name string `json:"name,required"`
	// The type of block in a message in an app feed.
	Type UserFeedListItemsResponseBlocksType `json:"type,required"`
	// This field can have the runtime type of
	// [[]UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlockButton].
	Buttons interface{} `json:"buttons"`
	// The content of the block in a message in an app feed.
	Content string `json:"content"`
	// The rendered HTML version of the content.
	Rendered string                             `json:"rendered"`
	JSON     userFeedListItemsResponseBlockJSON `json:"-"`
	// contains filtered or unexported fields
}

A content block for the feed, can be content or a button set.

func (UserFeedListItemsResponseBlock) AsUnion

AsUnion returns a UserFeedListItemsResponseBlocksUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are UserFeedListItemsResponseBlocksMessageInAppFeedContentBlock, UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlock.

func (*UserFeedListItemsResponseBlock) UnmarshalJSON

func (r *UserFeedListItemsResponseBlock) UnmarshalJSON(data []byte) (err error)

type UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlock

type UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlock struct {
	// A list of buttons in an in app feed message.
	Buttons []UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlockButton `json:"buttons,required"`
	// The name of the button set in a message in an app feed.
	Name string `json:"name,required"`
	// The type of block in a message in an app feed.
	Type UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlockType `json:"type,required"`
	JSON userFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlockJSON `json:"-"`
}

A button set block in a message in an app feed.

func (*UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlock) UnmarshalJSON

type UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlockButton

type UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlockButton struct {
	// The action to take when the button is clicked.
	Action string `json:"action,required"`
	// The label of the button.
	Label string `json:"label,required"`
	// The name of the button.
	Name string                                                                  `json:"name,required"`
	JSON userFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlockButtonJSON `json:"-"`
}

A button in an in app feed message.

func (*UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlockButton) UnmarshalJSON

type UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlockType

type UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlockType string

The type of block in a message in an app feed.

const (
	UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlockTypeButtonSet UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlockType = "button_set"
)

func (UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlockType) IsKnown

type UserFeedListItemsResponseBlocksMessageInAppFeedContentBlock

type UserFeedListItemsResponseBlocksMessageInAppFeedContentBlock struct {
	// The content of the block in a message in an app feed.
	Content string `json:"content,required"`
	// The name of the block in a message in an app feed.
	Name string `json:"name,required"`
	// The rendered HTML version of the content.
	Rendered string `json:"rendered,required"`
	// The type of block in a message in an app feed.
	Type UserFeedListItemsResponseBlocksMessageInAppFeedContentBlockType `json:"type,required"`
	JSON userFeedListItemsResponseBlocksMessageInAppFeedContentBlockJSON `json:"-"`
}

A block in a message in an app feed.

func (*UserFeedListItemsResponseBlocksMessageInAppFeedContentBlock) UnmarshalJSON

type UserFeedListItemsResponseBlocksMessageInAppFeedContentBlockType

type UserFeedListItemsResponseBlocksMessageInAppFeedContentBlockType string

The type of block in a message in an app feed.

const (
	UserFeedListItemsResponseBlocksMessageInAppFeedContentBlockTypeMarkdown UserFeedListItemsResponseBlocksMessageInAppFeedContentBlockType = "markdown"
	UserFeedListItemsResponseBlocksMessageInAppFeedContentBlockTypeText     UserFeedListItemsResponseBlocksMessageInAppFeedContentBlockType = "text"
)

func (UserFeedListItemsResponseBlocksMessageInAppFeedContentBlockType) IsKnown

type UserFeedListItemsResponseBlocksType

type UserFeedListItemsResponseBlocksType string

The type of block in a message in an app feed.

const (
	UserFeedListItemsResponseBlocksTypeMarkdown  UserFeedListItemsResponseBlocksType = "markdown"
	UserFeedListItemsResponseBlocksTypeText      UserFeedListItemsResponseBlocksType = "text"
	UserFeedListItemsResponseBlocksTypeButtonSet UserFeedListItemsResponseBlocksType = "button_set"
)

func (UserFeedListItemsResponseBlocksType) IsKnown

type UserFeedListItemsResponseBlocksUnion

type UserFeedListItemsResponseBlocksUnion interface {
	// contains filtered or unexported methods
}

A content block for the feed, can be content or a button set.

Union satisfied by UserFeedListItemsResponseBlocksMessageInAppFeedContentBlock or UserFeedListItemsResponseBlocksMessageInAppFeedButtonSetBlock.

type UserFeedListItemsResponseSource

type UserFeedListItemsResponseSource struct {
	// The typename of the schema.
	Typename string `json:"__typename,required"`
	// Categories this workflow belongs to.
	Categories []string `json:"categories,required"`
	// The key of the workflow.
	Key string `json:"key,required"`
	// The workflow version ID.
	VersionID string                              `json:"version_id,required" format:"uuid"`
	JSON      userFeedListItemsResponseSourceJSON `json:"-"`
}

Source information for the feed item.

func (*UserFeedListItemsResponseSource) UnmarshalJSON

func (r *UserFeedListItemsResponseSource) UnmarshalJSON(data []byte) (err error)

type UserFeedService

type UserFeedService struct {
	Options []option.RequestOption
}

UserFeedService contains methods and other services that help with interacting with the knock 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 NewUserFeedService method instead.

func NewUserFeedService

func NewUserFeedService(opts ...option.RequestOption) (r *UserFeedService)

NewUserFeedService 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 (*UserFeedService) GetSettings

func (r *UserFeedService) GetSettings(ctx context.Context, userID string, id string, opts ...option.RequestOption) (res *UserFeedGetSettingsResponse, err error)

Returns the feed settings for a user.

func (*UserFeedService) ListItems

Returns a paginated list of feed items for a user in reverse chronological order, including metadata about the feed. If the user has not yet been identified within Knock, an empty feed will be returned.

You can customize the response using [response filters](/integrations/in-app/knock#customizing-api-response-content) to exclude or only include specific properties on your resources.

**Notes:**

  • When making this call from a client-side environment, use your publishable key along with a user token.
  • This endpoint’s rate limit is always scoped per-user and per-environment. This is true even for requests made without a signed user token.

func (*UserFeedService) ListItemsAutoPaging

Returns a paginated list of feed items for a user in reverse chronological order, including metadata about the feed. If the user has not yet been identified within Knock, an empty feed will be returned.

You can customize the response using [response filters](/integrations/in-app/knock#customizing-api-response-content) to exclude or only include specific properties on your resources.

**Notes:**

  • When making this call from a client-side environment, use your publishable key along with a user token.
  • This endpoint’s rate limit is always scoped per-user and per-environment. This is true even for requests made without a signed user token.

type UserGetPreferencesParams

type UserGetPreferencesParams struct {
	// The unique identifier for the tenant.
	Tenant param.Field[string] `query:"tenant"`
}

func (UserGetPreferencesParams) URLQuery

func (r UserGetPreferencesParams) URLQuery() (v url.Values)

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

type UserGuideGetChannelParams

type UserGuideGetChannelParams struct {
	// The data (JSON encoded object) to use for targeting and rendering guides.
	Data param.Field[string] `query:"data"`
	// The tenant ID to use for targeting and rendering guides.
	Tenant param.Field[string] `query:"tenant"`
	// The type of guides to filter by.
	Type param.Field[string] `query:"type"`
}

func (UserGuideGetChannelParams) URLQuery

func (r UserGuideGetChannelParams) URLQuery() (v url.Values)

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

type UserGuideGetChannelResponse

type UserGuideGetChannelResponse struct {
	// A list of guides.
	Guides []UserGuideGetChannelResponseGuide `json:"guides,required"`
	// The recipient of the guide.
	Recipient UserGuideGetChannelResponseRecipient `json:"recipient,nullable"`
	JSON      userGuideGetChannelResponseJSON      `json:"-"`
}

A response for a list of guides.

func (*UserGuideGetChannelResponse) UnmarshalJSON

func (r *UserGuideGetChannelResponse) UnmarshalJSON(data []byte) (err error)

type UserGuideGetChannelResponseGuide

type UserGuideGetChannelResponseGuide struct {
	// The unique identifier for the guide.
	ID string `json:"id" format:"uuid"`
	// The content of the guide.
	Content string `json:"content"`
	// The metadata of the guide.
	Metadata map[string]interface{} `json:"metadata"`
	// The title of the guide.
	Title string                               `json:"title"`
	JSON  userGuideGetChannelResponseGuideJSON `json:"-"`
}

func (*UserGuideGetChannelResponseGuide) UnmarshalJSON

func (r *UserGuideGetChannelResponseGuide) UnmarshalJSON(data []byte) (err error)

type UserGuideGetChannelResponseRecipient

type UserGuideGetChannelResponseRecipient struct {
	// Unique identifier for the recipient.
	ID   string                                   `json:"id"`
	JSON userGuideGetChannelResponseRecipientJSON `json:"-"`
}

The recipient of the guide.

func (*UserGuideGetChannelResponseRecipient) UnmarshalJSON

func (r *UserGuideGetChannelResponseRecipient) UnmarshalJSON(data []byte) (err error)

type UserGuideMarkMessageAsArchivedParams

type UserGuideMarkMessageAsArchivedParams struct {
	// The unique identifier for the channel.
	ChannelID param.Field[string] `json:"channel_id,required" format:"uuid"`
	// The unique identifier for the guide.
	GuideID param.Field[string] `json:"guide_id,required" format:"uuid"`
	// The key of the guide.
	GuideKey param.Field[string] `json:"guide_key,required"`
	// The step reference of the guide.
	GuideStepRef param.Field[string] `json:"guide_step_ref,required"`
	// The content of the guide.
	Content param.Field[map[string]interface{}] `json:"content"`
	// The data of the guide.
	Data param.Field[map[string]interface{}] `json:"data"`
	// Whether the guide is final.
	IsFinal param.Field[bool] `json:"is_final"`
	// The metadata of the guide.
	Metadata param.Field[map[string]interface{}] `json:"metadata"`
	// The tenant ID of the guide.
	Tenant param.Field[string] `json:"tenant"`
}

func (UserGuideMarkMessageAsArchivedParams) MarshalJSON

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

type UserGuideMarkMessageAsArchivedResponse

type UserGuideMarkMessageAsArchivedResponse struct {
	// The status of a guide's action.
	Status string                                     `json:"status,required"`
	JSON   userGuideMarkMessageAsArchivedResponseJSON `json:"-"`
}

A response for a guide action.

func (*UserGuideMarkMessageAsArchivedResponse) UnmarshalJSON

func (r *UserGuideMarkMessageAsArchivedResponse) UnmarshalJSON(data []byte) (err error)

type UserGuideMarkMessageAsInteractedParams

type UserGuideMarkMessageAsInteractedParams struct {
	// The unique identifier for the channel.
	ChannelID param.Field[string] `json:"channel_id,required" format:"uuid"`
	// The unique identifier for the guide.
	GuideID param.Field[string] `json:"guide_id,required" format:"uuid"`
	// The key of the guide.
	GuideKey param.Field[string] `json:"guide_key,required"`
	// The step reference of the guide.
	GuideStepRef param.Field[string] `json:"guide_step_ref,required"`
	// The content of the guide.
	Content param.Field[map[string]interface{}] `json:"content"`
	// The data of the guide.
	Data param.Field[map[string]interface{}] `json:"data"`
	// Whether the guide is final.
	IsFinal param.Field[bool] `json:"is_final"`
	// The metadata of the guide.
	Metadata param.Field[map[string]interface{}] `json:"metadata"`
	// The tenant ID of the guide.
	Tenant param.Field[string] `json:"tenant"`
}

func (UserGuideMarkMessageAsInteractedParams) MarshalJSON

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

type UserGuideMarkMessageAsInteractedResponse

type UserGuideMarkMessageAsInteractedResponse struct {
	// The status of a guide's action.
	Status string                                       `json:"status,required"`
	JSON   userGuideMarkMessageAsInteractedResponseJSON `json:"-"`
}

A response for a guide action.

func (*UserGuideMarkMessageAsInteractedResponse) UnmarshalJSON

func (r *UserGuideMarkMessageAsInteractedResponse) UnmarshalJSON(data []byte) (err error)

type UserGuideMarkMessageAsSeenParams

type UserGuideMarkMessageAsSeenParams struct {
	// The unique identifier for the channel.
	ChannelID param.Field[string] `json:"channel_id,required" format:"uuid"`
	// The unique identifier for the guide.
	GuideID param.Field[string] `json:"guide_id,required" format:"uuid"`
	// The key of the guide.
	GuideKey param.Field[string] `json:"guide_key,required"`
	// The step reference of the guide.
	GuideStepRef param.Field[string] `json:"guide_step_ref,required"`
	// The content of the guide.
	Content param.Field[map[string]interface{}] `json:"content"`
	// The data of the guide.
	Data param.Field[map[string]interface{}] `json:"data"`
	// Whether the guide is final.
	IsFinal param.Field[bool] `json:"is_final"`
	// The metadata of the guide.
	Metadata param.Field[map[string]interface{}] `json:"metadata"`
	// The tenant ID of the guide.
	Tenant param.Field[string] `json:"tenant"`
}

func (UserGuideMarkMessageAsSeenParams) MarshalJSON

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

type UserGuideMarkMessageAsSeenResponse

type UserGuideMarkMessageAsSeenResponse struct {
	// The status of a guide's action.
	Status string                                 `json:"status,required"`
	JSON   userGuideMarkMessageAsSeenResponseJSON `json:"-"`
}

A response for a guide action.

func (*UserGuideMarkMessageAsSeenResponse) UnmarshalJSON

func (r *UserGuideMarkMessageAsSeenResponse) UnmarshalJSON(data []byte) (err error)

type UserGuideService

type UserGuideService struct {
	Options []option.RequestOption
}

UserGuideService contains methods and other services that help with interacting with the knock 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 NewUserGuideService method instead.

func NewUserGuideService

func NewUserGuideService(opts ...option.RequestOption) (r *UserGuideService)

NewUserGuideService 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 (*UserGuideService) GetChannel

func (r *UserGuideService) GetChannel(ctx context.Context, userID string, channelID string, query UserGuideGetChannelParams, opts ...option.RequestOption) (res *UserGuideGetChannelResponse, err error)

Returns a list of eligible in-app guides for a specific user and channel.

func (*UserGuideService) MarkMessageAsArchived

func (r *UserGuideService) MarkMessageAsArchived(ctx context.Context, userID string, messageID string, body UserGuideMarkMessageAsArchivedParams, opts ...option.RequestOption) (res *UserGuideMarkMessageAsArchivedResponse, err error)

Records that a guide has been archived by a user, triggering any associated archived events.

func (*UserGuideService) MarkMessageAsInteracted

func (r *UserGuideService) MarkMessageAsInteracted(ctx context.Context, userID string, messageID string, body UserGuideMarkMessageAsInteractedParams, opts ...option.RequestOption) (res *UserGuideMarkMessageAsInteractedResponse, err error)

Records that a user has interacted with a guide, triggering any associated interacted events.

func (*UserGuideService) MarkMessageAsSeen

func (r *UserGuideService) MarkMessageAsSeen(ctx context.Context, userID string, messageID string, body UserGuideMarkMessageAsSeenParams, opts ...option.RequestOption) (res *UserGuideMarkMessageAsSeenResponse, err error)

Records that a guide has been seen by a user, triggering any associated seen events.

type UserListMessagesParams

type UserListMessagesParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// Limits the results to items with the corresponding channel ID.
	ChannelID param.Field[string] `query:"channel_id"`
	// Limits the results to messages with the given engagement status.
	EngagementStatus param.Field[[]UserListMessagesParamsEngagementStatus] `query:"engagement_status"`
	InsertedAt       param.Field[UserListMessagesParamsInsertedAt]         `query:"inserted_at"`
	// Limits the results to only the message IDs given (max 50). Note: when using this
	// option, the results will be subject to any other filters applied to the query.
	MessageIDs param.Field[[]string] `query:"message_ids"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
	// Limits the results to messages triggered by the given workflow key.
	Source param.Field[string] `query:"source"`
	// Limits the results to messages with the given delivery status.
	Status param.Field[[]UserListMessagesParamsStatus] `query:"status"`
	// Limits the results to items with the corresponding tenant.
	Tenant param.Field[string] `query:"tenant"`
	// Limits the results to only messages that were generated with the given data. See
	// [trigger data filtering](/api-reference/overview/trigger-data-filtering) for
	// more information.
	TriggerData param.Field[string] `query:"trigger_data"`
	// Limits the results to messages related to any of the provided categories.
	WorkflowCategories param.Field[[]string] `query:"workflow_categories"`
	// Limits the results to messages for a specific recipient's workflow run.
	WorkflowRecipientRunID param.Field[string] `query:"workflow_recipient_run_id" format:"uuid"`
	// Limits the results to messages associated with the top-level workflow run ID
	// returned by the workflow trigger request.
	WorkflowRunID param.Field[string] `query:"workflow_run_id" format:"uuid"`
}

func (UserListMessagesParams) URLQuery

func (r UserListMessagesParams) URLQuery() (v url.Values)

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

type UserListMessagesParamsEngagementStatus

type UserListMessagesParamsEngagementStatus string
const (
	UserListMessagesParamsEngagementStatusSeen        UserListMessagesParamsEngagementStatus = "seen"
	UserListMessagesParamsEngagementStatusUnseen      UserListMessagesParamsEngagementStatus = "unseen"
	UserListMessagesParamsEngagementStatusRead        UserListMessagesParamsEngagementStatus = "read"
	UserListMessagesParamsEngagementStatusUnread      UserListMessagesParamsEngagementStatus = "unread"
	UserListMessagesParamsEngagementStatusArchived    UserListMessagesParamsEngagementStatus = "archived"
	UserListMessagesParamsEngagementStatusUnarchived  UserListMessagesParamsEngagementStatus = "unarchived"
	UserListMessagesParamsEngagementStatusLinkClicked UserListMessagesParamsEngagementStatus = "link_clicked"
	UserListMessagesParamsEngagementStatusInteracted  UserListMessagesParamsEngagementStatus = "interacted"
)

func (UserListMessagesParamsEngagementStatus) IsKnown

type UserListMessagesParamsInsertedAt

type UserListMessagesParamsInsertedAt struct {
	// Limits the results to messages inserted after the given date.
	Gt param.Field[string] `query:"gt"`
	// Limits the results to messages inserted after or on the given date.
	Gte param.Field[string] `query:"gte"`
	// Limits the results to messages inserted before the given date.
	Lt param.Field[string] `query:"lt"`
	// Limits the results to messages inserted before or on the given date.
	Lte param.Field[string] `query:"lte"`
}

func (UserListMessagesParamsInsertedAt) URLQuery

func (r UserListMessagesParamsInsertedAt) URLQuery() (v url.Values)

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

type UserListMessagesParamsStatus

type UserListMessagesParamsStatus string
const (
	UserListMessagesParamsStatusQueued            UserListMessagesParamsStatus = "queued"
	UserListMessagesParamsStatusSent              UserListMessagesParamsStatus = "sent"
	UserListMessagesParamsStatusDelivered         UserListMessagesParamsStatus = "delivered"
	UserListMessagesParamsStatusDeliveryAttempted UserListMessagesParamsStatus = "delivery_attempted"
	UserListMessagesParamsStatusUndelivered       UserListMessagesParamsStatus = "undelivered"
	UserListMessagesParamsStatusNotSent           UserListMessagesParamsStatus = "not_sent"
	UserListMessagesParamsStatusBounced           UserListMessagesParamsStatus = "bounced"
)

func (UserListMessagesParamsStatus) IsKnown

func (r UserListMessagesParamsStatus) IsKnown() bool

type UserListParams

type UserListParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// Associated resources to include in the response.
	Include param.Field[[]UserListParamsInclude] `query:"include"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
}

func (UserListParams) URLQuery

func (r UserListParams) URLQuery() (v url.Values)

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

type UserListParamsInclude

type UserListParamsInclude string
const (
	UserListParamsIncludePreferences UserListParamsInclude = "preferences"
)

func (UserListParamsInclude) IsKnown

func (r UserListParamsInclude) IsKnown() bool

type UserListSchedulesParams

type UserListSchedulesParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
	// The tenant ID to filter schedules for.
	Tenant param.Field[string] `query:"tenant"`
	// The workflow key to filter schedules for.
	Workflow param.Field[string] `query:"workflow"`
}

func (UserListSchedulesParams) URLQuery

func (r UserListSchedulesParams) URLQuery() (v url.Values)

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

type UserListSubscriptionsParams

type UserListSubscriptionsParams struct {
	// The cursor to fetch entries after.
	After param.Field[string] `query:"after"`
	// The cursor to fetch entries before.
	Before param.Field[string] `query:"before"`
	// Associated resources to include in the response.
	Include param.Field[[]UserListSubscriptionsParamsInclude] `query:"include"`
	// Only returns subscriptions for the specified object references.
	Objects param.Field[[]RecipientReferenceUnionParam] `query:"objects"`
	// The number of items per page (defaults to 50).
	PageSize param.Field[int64] `query:"page_size"`
}

func (UserListSubscriptionsParams) URLQuery

func (r UserListSubscriptionsParams) URLQuery() (v url.Values)

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

type UserListSubscriptionsParamsInclude

type UserListSubscriptionsParamsInclude string
const (
	UserListSubscriptionsParamsIncludePreferences UserListSubscriptionsParamsInclude = "preferences"
)

func (UserListSubscriptionsParamsInclude) IsKnown

type UserMergeParams

type UserMergeParams struct {
	// The user ID to merge from.
	FromUserID param.Field[string] `json:"from_user_id,required"`
}

func (UserMergeParams) MarshalJSON

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

type UserService

type UserService struct {
	Options []option.RequestOption
	Feeds   *UserFeedService
	Guides  *UserGuideService
	Bulk    *UserBulkService
}

UserService contains methods and other services that help with interacting with the knock 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 NewUserService method instead.

func NewUserService

func NewUserService(opts ...option.RequestOption) (r *UserService)

NewUserService 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 (*UserService) Delete

func (r *UserService) Delete(ctx context.Context, userID string, opts ...option.RequestOption) (res *string, err error)

Permanently delete a user and all associated data.

func (*UserService) Get

func (r *UserService) Get(ctx context.Context, userID string, opts ...option.RequestOption) (res *User, err error)

Retrieve a specific user by their ID.

func (*UserService) GetChannelData

func (r *UserService) GetChannelData(ctx context.Context, userID string, channelID string, opts ...option.RequestOption) (res *ChannelData, err error)

Retrieves the channel data for a specific user and channel ID.

func (*UserService) GetPreferences

func (r *UserService) GetPreferences(ctx context.Context, userID string, id string, query UserGetPreferencesParams, opts ...option.RequestOption) (res *PreferenceSet, err error)

Retrieves a specific preference set for a user identified by the preference set ID.

func (*UserService) List

func (r *UserService) List(ctx context.Context, query UserListParams, opts ...option.RequestOption) (res *pagination.EntriesCursor[User], err error)

Retrieve a paginated list of users in the environment. Defaults to 50 users per page.

func (*UserService) ListAutoPaging

Retrieve a paginated list of users in the environment. Defaults to 50 users per page.

func (*UserService) ListMessages

func (r *UserService) ListMessages(ctx context.Context, userID string, query UserListMessagesParams, opts ...option.RequestOption) (res *pagination.ItemsCursor[Message], err error)

Returns a paginated list of messages for a specific user. Messages are sorted with the most recent ones appearing first. Messages outside the account's retention window will not be included in the results.

func (*UserService) ListMessagesAutoPaging

func (r *UserService) ListMessagesAutoPaging(ctx context.Context, userID string, query UserListMessagesParams, opts ...option.RequestOption) *pagination.ItemsCursorAutoPager[Message]

Returns a paginated list of messages for a specific user. Messages are sorted with the most recent ones appearing first. Messages outside the account's retention window will not be included in the results.

func (*UserService) ListPreferences

func (r *UserService) ListPreferences(ctx context.Context, userID string, opts ...option.RequestOption) (res *[]PreferenceSet, err error)

Retrieves a list of all preference sets for a specific user.

func (*UserService) ListSchedules

func (r *UserService) ListSchedules(ctx context.Context, userID string, query UserListSchedulesParams, opts ...option.RequestOption) (res *pagination.EntriesCursor[Schedule], err error)

Returns a paginated list of schedules for a specific user, in descending order.

func (*UserService) ListSchedulesAutoPaging

func (r *UserService) ListSchedulesAutoPaging(ctx context.Context, userID string, query UserListSchedulesParams, opts ...option.RequestOption) *pagination.EntriesCursorAutoPager[Schedule]

Returns a paginated list of schedules for a specific user, in descending order.

func (*UserService) ListSubscriptions

func (r *UserService) ListSubscriptions(ctx context.Context, userID string, query UserListSubscriptionsParams, opts ...option.RequestOption) (res *pagination.EntriesCursor[Subscription], err error)

Retrieves a paginated list of subscriptions for a specific user, in descending order.

func (*UserService) ListSubscriptionsAutoPaging

Retrieves a paginated list of subscriptions for a specific user, in descending order.

func (*UserService) Merge

func (r *UserService) Merge(ctx context.Context, userID string, body UserMergeParams, opts ...option.RequestOption) (res *User, err error)

Merge two users together, where the user specified with the `from_user_id` param will be merged into the user specified by `user_id`.

func (*UserService) SetChannelData

func (r *UserService) SetChannelData(ctx context.Context, userID string, channelID string, body UserSetChannelDataParams, opts ...option.RequestOption) (res *ChannelData, err error)

Updates or creates channel data for a specific user and channel ID. If no user exists in the current environment for the given `user_id`, Knock will create the user entry as part of this request.

func (*UserService) SetPreferences

func (r *UserService) SetPreferences(ctx context.Context, userID string, id string, body UserSetPreferencesParams, opts ...option.RequestOption) (res *PreferenceSet, err error)

Updates a complete preference set for a user. By default, this is a destructive operation and will replace any existing preferences with the preferences given. Use '**persistence_strategy**': 'merge' to merge with existing preferences instead.

func (*UserService) UnsetChannelData

func (r *UserService) UnsetChannelData(ctx context.Context, userID string, channelID string, opts ...option.RequestOption) (res *string, err error)

Deletes channel data for a specific user and channel ID.

func (*UserService) Update

func (r *UserService) Update(ctx context.Context, userID string, body UserUpdateParams, opts ...option.RequestOption) (res *User, err error)

Create or update a user with the provided identification data. When you identify an existing user, the system merges the properties you specific with what is currently set on the user, updating only the fields included in your requests.

type UserSetChannelDataParams

type UserSetChannelDataParams struct {
	// A request to set channel data for a type of channel.
	ChannelDataRequest ChannelDataRequestParam `json:"channel_data_request,required"`
}

func (UserSetChannelDataParams) MarshalJSON

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

type UserSetPreferencesParams

type UserSetPreferencesParams struct {
	// A request to set a preference set for a recipient.
	PreferenceSetRequest PreferenceSetRequestParam `json:"preference_set_request,required"`
}

func (UserSetPreferencesParams) MarshalJSON

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

type UserUpdateParams

type UserUpdateParams struct {
	// A set of parameters to identify a user with. Does not include the user ID, as
	// that's specified elsewhere in the request. You can supply any additional
	// properties you'd like to upsert for the user.
	IdentifyUserRequest IdentifyUserRequestParam `json:"identify_user_request,required"`
}

func (UserUpdateParams) MarshalJSON

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

type WorkflowCancelParams

type WorkflowCancelParams struct {
	// An optional key that is used to reference a specific workflow trigger request
	// when issuing a [workflow cancellation](/send-notifications/canceling-workflows)
	// request. Must be provided while triggering a workflow in order to enable
	// subsequent cancellation. Should be unique across trigger requests to avoid
	// unintentional cancellations.
	CancellationKey param.Field[string] `json:"cancellation_key,required"`
	// A list of recipients to cancel the notification for. If omitted, cancels for all
	// recipients associated with the cancellation key.
	Recipients param.Field[[]RecipientReferenceUnionParam] `json:"recipients"`
}

func (WorkflowCancelParams) MarshalJSON

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

type WorkflowService

type WorkflowService struct {
	Options []option.RequestOption
}

WorkflowService contains methods and other services that help with interacting with the knock 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 NewWorkflowService method instead.

func NewWorkflowService

func NewWorkflowService(opts ...option.RequestOption) (r *WorkflowService)

NewWorkflowService 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 (*WorkflowService) Cancel

func (r *WorkflowService) Cancel(ctx context.Context, key string, body WorkflowCancelParams, opts ...option.RequestOption) (res *string, err error)

When invoked for a workflow using a specific workflow key and cancellation key, will cancel any queued workflow runs associated with that key/cancellation key pair. Can optionally be provided one or more recipients to scope the request to.

func (*WorkflowService) Trigger

Trigger a workflow (specified by the key) to run for the given recipients, using the parameters provided. Returns an identifier for the workflow run request. All workflow runs are executed asynchronously. This endpoint also handles [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients) for the `actor`, `recipient`, and `tenant` fields.

type WorkflowTriggerParams

type WorkflowTriggerParams struct {
	// The recipients to trigger the workflow for. Can inline identify users, objects,
	// or use a list of user IDs. Limited to 1,000 recipients.
	Recipients param.Field[[]RecipientRequestUnionParam] `json:"recipients,required"`
	// Specifies a recipient in a request. This can either be a user identifier
	// (string), an inline user request (object), or an inline object request, which is
	// determined by the presence of a `collection` property.
	Actor param.Field[RecipientRequestUnionParam] `json:"actor"`
	// An optional key that is used to reference a specific workflow trigger request
	// when issuing a [workflow cancellation](/send-notifications/canceling-workflows)
	// request. Must be provided while triggering a workflow in order to enable
	// subsequent cancellation. Should be unique across trigger requests to avoid
	// unintentional cancellations.
	CancellationKey param.Field[string] `json:"cancellation_key"`
	// An optional map of data to pass into the workflow execution. There is a 10MB
	// limit on the size of the full `data` payload. Any individual string value
	// greater than 1024 bytes in length will be
	// [truncated](/developer-tools/api-logs#log-truncation) in your logs.
	Data param.Field[map[string]interface{}] `json:"data"`
	// An request to set a tenant inline.
	Tenant param.Field[InlineTenantRequestUnionParam] `json:"tenant"`
}

func (WorkflowTriggerParams) MarshalJSON

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

type WorkflowTriggerResponse

type WorkflowTriggerResponse struct {
	// This value allows you to track individual messages associated with this trigger
	// request.
	WorkflowRunID string                      `json:"workflow_run_id,required" format:"uuid"`
	JSON          workflowTriggerResponseJSON `json:"-"`
}

The response from triggering a workflow.

func (*WorkflowTriggerResponse) UnmarshalJSON

func (r *WorkflowTriggerResponse) UnmarshalJSON(data []byte) (err error)

Directories

Path Synopsis
packages

Jump to

Keyboard shortcuts

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