Documentation ¶
Index ¶
- Constants
- func NewBulkOperationsService(client *Client) *bulkOperationsService
- func NewMessagesService(client *Client) *messagesService
- func NewObjectService(client *Client) *objectsService
- func NewTenantService(client *Client) *tenantsService
- func NewUsersService(client *Client) *usersService
- func NewWorkflowsService(client *Client) *workflowsService
- func ParseRFC3339Timestamp(input string) time.Time
- func PreferencesMapAppend(m map[string]interface{}, new map[string]interface{}) map[string]interface{}
- func UsersAPIPath(userId string) string
- type AddSubscriptionsRequest
- type AddSubscriptionsResponse
- type BatchSetStatusRequest
- type BatchSetStatusResponse
- type BulkAddObjectSubscription
- type BulkAddSubscriptionsRequest
- type BulkChangeChannelStatusRequest
- type BulkChangeChannelStatusResponse
- type BulkDeleteObjectsRequest
- type BulkDeleteUserRequest
- type BulkDeleteUserResponse
- type BulkIdentifyUserRequest
- type BulkIdentifyUserResponse
- type BulkOperation
- type BulkOperationStatus
- type BulkOperationsService
- type BulkRequestResponse
- type BulkSetObject
- type BulkSetObjectsRequest
- type BulkSetUserPreferencesRequest
- func (br *BulkSetUserPreferencesRequest) AddCategoriesPreference(category map[string]interface{}) BulkSetUserPreferencesRequest
- func (br *BulkSetUserPreferencesRequest) AddChannelTypesPreference(channelType map[string]interface{}) BulkSetUserPreferencesRequest
- func (br *BulkSetUserPreferencesRequest) AddWorkflowsPreference(workflow map[string]interface{}) BulkSetUserPreferencesRequest
- type BulkSetUserPreferencesResponse
- type CancelWorkflowRequest
- type ChannelData
- type Client
- type ClientOption
- type CreateSchedulesRequest
- func (csr *CreateSchedulesRequest) AddActorByEntity(entity map[string]interface{}) CreateSchedulesRequest
- func (csr *CreateSchedulesRequest) AddActorByID(actorID string) CreateSchedulesRequest
- func (csr *CreateSchedulesRequest) AddRecipientByEntity(entity map[string]interface{}) CreateSchedulesRequest
- func (csr *CreateSchedulesRequest) AddRecipientByID(recipientID string) CreateSchedulesRequest
- func (csr *CreateSchedulesRequest) AddRepeat(repeat *ScheduleRepeat) CreateSchedulesRequest
- func (csr *CreateSchedulesRequest) AddTenantByEntity(entity map[string]interface{}) CreateSchedulesRequest
- func (csr *CreateSchedulesRequest) AddTenantByID(tenantID string) CreateSchedulesRequest
- type DeleteObjectChannelDataRequest
- type DeleteObjectRequest
- type DeleteSchedulesRequest
- type DeleteStatusRequest
- type DeleteStatusResponse
- type DeleteSubscriptionsRequest
- type DeleteSubscriptionsResponse
- type DeleteTenantRequest
- type DeleteUserChannelDataRequest
- type DeleteUserRequest
- type EngagementStatus
- type Error
- type ErrorCode
- type Feed
- type FeedBlock
- type FeedItem
- type FeedMetadata
- type GetAllPreferencesRequest
- type GetAllPreferencesResponse
- type GetBulkOperationRequest
- type GetBulkOperationResponse
- type GetFeedRequest
- type GetFeedResponse
- type GetMessageActivitiesRequest
- type GetMessageActivitiesResponse
- type GetMessageContentRequest
- type GetMessageContentResponse
- type GetMessageEventsRequest
- type GetMessageEventsResponse
- type GetMessageRequest
- type GetMessageResponse
- type GetObjectChannelDataRequest
- type GetObjectChannelDataResponse
- type GetObjectMessagesRequest
- type GetObjectMessagesResponse
- type GetObjectPreferencesRequest
- type GetObjectPreferencesResponse
- type GetObjectRequest
- type GetObjectResponse
- type GetObjectSchedulesRequest
- type GetObjectSchedulesResponse
- type GetObjectSubscriptionsRequest
- type GetObjectSubscriptionsResponse
- type GetTenantRequest
- type GetTenantResponse
- type GetUserChannelDataRequest
- type GetUserChannelDataResponse
- type GetUserMessagesRequest
- type GetUserMessagesResponse
- type GetUserPreferencesRequest
- type GetUserPreferencesResponse
- type GetUserRequest
- type GetUserResponse
- type GetUserSchedulesRequest
- type GetUserSchedulesResponse
- type GetUserSubscriptionsRequest
- type GetUserSubscriptionsResponse
- type IdentifyUserRequest
- type IdentifyUserResponse
- type ListMessagesRequest
- type ListMessagesResponse
- type ListObjectsRequest
- type ListObjectsResponse
- type ListSchedulesRequest
- type ListSchedulesResponse
- type ListSubscriptionsRequest
- type ListSubscriptionsResponse
- type ListTenantsRequest
- type ListTenantsResponse
- type ListUsersRequest
- type ListUsersResponse
- type MergeUserRequest
- type MergeUserResponse
- type Message
- type MessageActivity
- type MessageContent
- type MessageEvent
- type MessageStatus
- type MessagesService
- type MethodOptions
- type NotificationSource
- type Object
- type ObjectMessage
- type ObjectSubscription
- type ObjectsService
- type PageInfo
- type PreferenceSet
- type Schedule
- type ScheduleRepeat
- type SetObjectChannelDataRequest
- type SetObjectChannelDataResponse
- type SetObjectPreferencesRequest
- func (sr *SetObjectPreferencesRequest) AddCategoriesPreference(categories map[string]interface{}) SetObjectPreferencesRequest
- func (sr *SetObjectPreferencesRequest) AddChannelTypesPreference(channelType map[string]interface{}) SetObjectPreferencesRequest
- func (sr *SetObjectPreferencesRequest) AddWorkflowsPreference(workflows map[string]interface{}) SetObjectPreferencesRequest
- type SetObjectPreferencesResponse
- type SetObjectRequest
- type SetObjectResponse
- type SetStatusRequest
- type SetStatusResponse
- type SetTenantRequest
- type SetTenantResponse
- type SetUserChannelDataRequest
- type SetUserChannelDataResponse
- type SetUserPreferencesRequest
- func (sr *SetUserPreferencesRequest) AddCategoriesPreference(categories map[string]interface{}) SetUserPreferencesRequest
- func (sr *SetUserPreferencesRequest) AddChannelTypesPreference(channelType map[string]interface{}) SetUserPreferencesRequest
- func (sr *SetUserPreferencesRequest) AddWorkflowsPreference(workflows map[string]interface{}) SetUserPreferencesRequest
- type SetUserPreferencesResponse
- type Tenant
- type TenantsService
- type TriggerWorkflowRequest
- func (tr *TriggerWorkflowRequest) AddActorByEntity(entity map[string]interface{}) TriggerWorkflowRequest
- func (tr *TriggerWorkflowRequest) AddActorByID(actorID string) TriggerWorkflowRequest
- func (tr *TriggerWorkflowRequest) AddRecipientByEntity(entity map[string]interface{}) TriggerWorkflowRequest
- func (tr *TriggerWorkflowRequest) AddRecipientByID(recipientID string) TriggerWorkflowRequest
- func (tr *TriggerWorkflowRequest) AddTenantByEntity(entity map[string]interface{}) TriggerWorkflowRequest
- func (tr *TriggerWorkflowRequest) AddTenantByID(tenantID string) TriggerWorkflowRequest
- type TriggerWorkflowResponse
- type UpdateSchedulesRequest
- func (usr *UpdateSchedulesRequest) AddActorByEntity(entity map[string]interface{}) UpdateSchedulesRequest
- func (usr *UpdateSchedulesRequest) AddActorByID(actorID string) UpdateSchedulesRequest
- func (usr *UpdateSchedulesRequest) AddRepeat(repeat *ScheduleRepeat) UpdateSchedulesRequest
- func (usr *UpdateSchedulesRequest) AddTenantByEntity(entity map[string]interface{}) UpdateSchedulesRequest
- func (usr *UpdateSchedulesRequest) AddTenantByID(tenantID string) UpdateSchedulesRequest
- type User
- type UsersService
- type WorkflowsService
Constants ¶
const (
DefaultBaseUrl = "https://api.knock.app/"
)
Variables ¶
This section is empty.
Functions ¶
func NewBulkOperationsService ¶
func NewBulkOperationsService(client *Client) *bulkOperationsService
func NewMessagesService ¶
func NewMessagesService(client *Client) *messagesService
func NewObjectService ¶
func NewObjectService(client *Client) *objectsService
func NewTenantService ¶ added in v0.1.2
func NewTenantService(client *Client) *tenantsService
func NewUsersService ¶
func NewUsersService(client *Client) *usersService
func NewWorkflowsService ¶
func NewWorkflowsService(client *Client) *workflowsService
func ParseRFC3339Timestamp ¶
func PreferencesMapAppend ¶ added in v0.1.1
func UsersAPIPath ¶
Types ¶
type AddSubscriptionsRequest ¶ added in v0.1.4
type AddSubscriptionsResponse ¶ added in v0.1.4
type AddSubscriptionsResponse struct {
Subscriptions []*ObjectSubscription
}
type BatchSetStatusRequest ¶
type BatchSetStatusRequest struct { Status MessageStatus `json:"-"` MessageIDs []string `json:"message_ids"` }
type BatchSetStatusResponse ¶
type BatchSetStatusResponse struct {
Messages []*Message
}
type BulkAddObjectSubscription ¶ added in v0.1.9
type BulkAddSubscriptionsRequest ¶ added in v0.1.9
type BulkAddSubscriptionsRequest struct { Collection string `json:"-"` Subscriptions []*BulkAddObjectSubscription `json:"subscriptions"` }
type BulkChangeChannelStatusRequest ¶
type BulkChangeChannelStatusRequest struct { ChannelID string `json:"-"` Status MessageStatus `json:"-"` UserIDs []string `json:"user_ids,omitempty"` OlderThan *time.Time `json:"older_than,omitempty"` NewerThan *time.Time `json:"newer_than,omitempty"` DeliveryStatus EngagementStatus `json:"delivery_status,omitempty"` EngagementStatus string `json:"engagement_status,omitempty"` }
type BulkChangeChannelStatusResponse ¶
type BulkChangeChannelStatusResponse struct {
BulkOperation *BulkOperation
}
type BulkDeleteObjectsRequest ¶ added in v0.1.9
type BulkDeleteUserRequest ¶
type BulkDeleteUserRequest struct {
UserIDs []string `json:"user_ids"`
}
type BulkDeleteUserResponse ¶
type BulkDeleteUserResponse = BulkIdentifyUserResponse
type BulkIdentifyUserRequest ¶
type BulkIdentifyUserRequest struct {
Users []*IdentifyUserRequest
}
type BulkIdentifyUserResponse ¶
type BulkIdentifyUserResponse struct {
BulkOperation *BulkOperation
}
type BulkOperation ¶
type BulkOperation struct { ID string `json:"id"` CompletedAt time.Time `json:"completed_at"` FailedAt time.Time `json:"failed_at"` StartedAt time.Time `json:"started_at"` InsertedAt time.Time `json:"inserted_at"` UpdatedAt time.Time `json:"updated_at"` EstimatedTotalRows int `json:"estimated_total_rows"` ProcessedRows int `json:"processed_rows"` ProgressPath string `json:"progress_path"` Status BulkOperationStatus `json:"status"` }
type BulkOperationStatus ¶
type BulkOperationStatus string
const ( BulkOperationQueued BulkOperationStatus = "queued" Processing BulkOperationStatus = "processing" Completed BulkOperationStatus = "completed" Failed BulkOperationStatus = "failed" )
type BulkOperationsService ¶
type BulkOperationsService interface {
Get(context.Context, *GetBulkOperationRequest) (*BulkOperation, error)
}
BulkOperationsService is an interface for communicating with API endpoints that return BulkOperations, which are used by other services including the UsersService and MessagesService
type BulkRequestResponse ¶ added in v0.1.9
type BulkRequestResponse struct {
BulkOperation *BulkOperation
}
type BulkSetObject ¶ added in v0.1.9
type BulkSetObjectsRequest ¶ added in v0.1.9
type BulkSetObjectsRequest struct { Collection string `json:"-"` Objects []*BulkSetObject `json:"objects"` }
type BulkSetUserPreferencesRequest ¶
type BulkSetUserPreferencesRequest struct { UserIDs []string `json:"user_ids"` Preferences PreferenceSet `json:"preferences"` }
func (*BulkSetUserPreferencesRequest) AddCategoriesPreference ¶ added in v0.1.1
func (br *BulkSetUserPreferencesRequest) AddCategoriesPreference(category map[string]interface{}) BulkSetUserPreferencesRequest
func (*BulkSetUserPreferencesRequest) AddChannelTypesPreference ¶ added in v0.1.1
func (br *BulkSetUserPreferencesRequest) AddChannelTypesPreference(channelType map[string]interface{}) BulkSetUserPreferencesRequest
func (*BulkSetUserPreferencesRequest) AddWorkflowsPreference ¶ added in v0.1.1
func (br *BulkSetUserPreferencesRequest) AddWorkflowsPreference(workflow map[string]interface{}) BulkSetUserPreferencesRequest
type BulkSetUserPreferencesResponse ¶
type BulkSetUserPreferencesResponse = BulkIdentifyUserResponse
type CancelWorkflowRequest ¶
type CancelWorkflowRequest struct { Workflow string `json:"workflow"` Recipients []interface{} `json:"recipients"` CancellationKey string `json:"cancellation_key"` }
func (*CancelWorkflowRequest) AddRecipientByEntity ¶ added in v0.1.1
func (tr *CancelWorkflowRequest) AddRecipientByEntity(entity map[string]interface{}) CancelWorkflowRequest
func (*CancelWorkflowRequest) AddRecipientByID ¶ added in v0.1.1
func (tr *CancelWorkflowRequest) AddRecipientByID(recipientID string) CancelWorkflowRequest
type ChannelData ¶
type Client ¶
type Client struct { BulkOperations BulkOperationsService Messages MessagesService Objects ObjectsService Tenants TenantsService Users UsersService Workflows WorkflowsService // contains filtered or unexported fields }
Client encapsulates a client that talks to the Knock API
func NewClient ¶
func NewClient(opts ...ClientOption) (*Client, error)
NewClient instantiates an instance of the Knock API client.
type ClientOption ¶
ClientOption provides a variadic option for configuring the client
func WithAccessToken ¶
func WithAccessToken(token string) ClientOption
WithAccessToken configures a client with the given Knock access token.
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL overrides the base URL for the API.
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) ClientOption
WithHTTPClient configures the Knock client with the given HTTP client.
type CreateSchedulesRequest ¶ added in v0.1.6
type CreateSchedulesRequest struct { Workflow string `json:"workflow"` Recipients []interface{} `json:"recipients"` Repeats []*ScheduleRepeat `json:"repeats"` Actor interface{} `json:"actor,omitempty"` Tenant interface{} `json:"tenant,omitempty"` ScheduledAt time.Time `json:"scheduled_at,omitempty"` Data map[string]interface{} `json:"data,omitempty"` }
func (*CreateSchedulesRequest) AddActorByEntity ¶ added in v0.1.6
func (csr *CreateSchedulesRequest) AddActorByEntity(entity map[string]interface{}) CreateSchedulesRequest
func (*CreateSchedulesRequest) AddActorByID ¶ added in v0.1.6
func (csr *CreateSchedulesRequest) AddActorByID(actorID string) CreateSchedulesRequest
func (*CreateSchedulesRequest) AddRecipientByEntity ¶ added in v0.1.6
func (csr *CreateSchedulesRequest) AddRecipientByEntity(entity map[string]interface{}) CreateSchedulesRequest
func (*CreateSchedulesRequest) AddRecipientByID ¶ added in v0.1.6
func (csr *CreateSchedulesRequest) AddRecipientByID(recipientID string) CreateSchedulesRequest
func (*CreateSchedulesRequest) AddRepeat ¶ added in v0.1.6
func (csr *CreateSchedulesRequest) AddRepeat(repeat *ScheduleRepeat) CreateSchedulesRequest
func (*CreateSchedulesRequest) AddTenantByEntity ¶ added in v0.1.14
func (csr *CreateSchedulesRequest) AddTenantByEntity(entity map[string]interface{}) CreateSchedulesRequest
func (*CreateSchedulesRequest) AddTenantByID ¶ added in v0.1.14
func (csr *CreateSchedulesRequest) AddTenantByID(tenantID string) CreateSchedulesRequest
type DeleteObjectChannelDataRequest ¶
type DeleteObjectChannelDataRequest = GetObjectChannelDataRequest
type DeleteObjectRequest ¶
type DeleteObjectRequest = GetObjectRequest
type DeleteSchedulesRequest ¶ added in v0.1.6
type DeleteSchedulesRequest struct {
ScheduleIDs []string `json:"schedule_ids"`
}
type DeleteStatusRequest ¶
type DeleteStatusRequest = SetStatusRequest
type DeleteStatusResponse ¶
type DeleteStatusResponse = GetMessageResponse
type DeleteSubscriptionsRequest ¶ added in v0.1.4
type DeleteSubscriptionsResponse ¶ added in v0.1.4
type DeleteSubscriptionsResponse struct {
Subscriptions []*ObjectSubscription
}
type DeleteTenantRequest ¶ added in v0.1.2
type DeleteTenantRequest = GetTenantRequest
type DeleteUserChannelDataRequest ¶
type DeleteUserChannelDataRequest = GetUserChannelDataRequest
type DeleteUserRequest ¶
type DeleteUserRequest struct {
ID string
}
type EngagementStatus ¶
type EngagementStatus string
const ( Queued EngagementStatus = "queued" Sent EngagementStatus = "sent" Delivered EngagementStatus = "delivered" Undelivered EngagementStatus = "undelivered" )
User message query statuses
type Error ¶
type Error struct { // Code specifies the error code. i.e; NotFound, RateLimited, etc... Code ErrorCode // Meta contains additional information depending on the error code. As an // example, if the Code is "ErrResponseMalformed", the map will be: ["body"] // = "body of the response" Meta map[string]string // contains filtered or unexported fields }
Error represents common errors originating from the Client.
type ErrorCode ¶
type ErrorCode string
ErrorCode defines the code of an error.
const ( ErrInternal ErrorCode = "internal" // Internal error. ErrInvalid ErrorCode = "invalid" // Invalid operation, e.g wrong params ErrPermission ErrorCode = "permission" // Permission denied. ErrNotFound ErrorCode = "not_found" // Resource not found. ErrRetry ErrorCode = "retry" // Operation should be retried. ErrResponseMalformed ErrorCode = "response_malformed" // Response body is malformed. )
type Feed ¶
type Feed struct { FeedItems []*FeedItem `json:"entries"` PageInfo *PageInfo `json:"page_info"` Vars map[string]interface{} `json:"vars"` FeedMetadata *FeedMetadata `json:"meta"` }
Context structs
type FeedItem ¶
type FeedItem struct { ID string `json:"id"` Activities []*MessageActivity `json:"activities"` Actors []*User `json:"actors"` TotalActivities int `json:"total_activities"` TotalActors int `json:"total_actors"` Blocks []*FeedBlock `json:"blocks"` Data map[string]interface{} `json:"vars"` InsertedAt time.Time `json:"inserted_at"` UpdatedAt time.Time `json:"updated_at"` ReadAt time.Time `json:"read_at"` SeenAt time.Time `json:"seen_at"` ArchivedAt time.Time `json:"archived_at"` Source NotificationSource `json:"source"` Tenant string `json:"tenant"` }
type FeedMetadata ¶
type GetAllPreferencesRequest ¶
type GetAllPreferencesRequest struct {
UserID string `json:"-"`
}
type GetAllPreferencesResponse ¶
type GetAllPreferencesResponse struct {
Preferences []*PreferenceSet
}
type GetBulkOperationResponse ¶
type GetBulkOperationResponse struct {
BulkOperation *BulkOperation
}
type GetFeedRequest ¶
type GetFeedRequest struct { UserID string `url:"-"` FeedID string `url:"-"` PageSize int `url:"page_size,omitempty"` After string `url:"after,omitempty"` Before string `url:"before,omitempty"` Status []string `url:"status,omitempty"` Source string `url:"source,omitempty"` Tenant string `url:"tenant,omitempty"` HasTenant bool `url:"has_tenant,omitempty"` Archived string `url:"archived,omitempty"` TriggerData map[string]interface{} `url:"-"` }
type GetFeedResponse ¶
type GetFeedResponse struct {
Feed *Feed
}
type GetMessageActivitiesResponse ¶
type GetMessageActivitiesResponse struct { Activities []*MessageActivity `json:"items"` PageInfo *PageInfo `json:"page_info"` }
type GetMessageContentRequest ¶
type GetMessageContentRequest = GetMessageRequest
type GetMessageContentResponse ¶
type GetMessageContentResponse struct {
Content *MessageContent
}
type GetMessageEventsRequest ¶
type GetMessageEventsRequest = GetMessageRequest
type GetMessageEventsResponse ¶
type GetMessageEventsResponse struct { Items []*MessageEvent `json:"items"` PageInfo *PageInfo `json:"page_info"` }
type GetMessageRequest ¶
type GetMessageRequest struct {
ID string
}
type GetMessageResponse ¶
type GetMessageResponse struct {
Message *Message
}
type GetObjectChannelDataResponse ¶
type GetObjectChannelDataResponse = GetUserChannelDataResponse
type GetObjectMessagesRequest ¶
type GetObjectMessagesRequest struct { ObjectID string `url:"-"` Collection string `url:"-"` PageSize int `url:"page_size,omitempty"` Before string `url:"before,omitempty"` After string `url:"after,omitempty"` Source string `url:"source,omitempty"` Tenant string `url:"tenant,omitempty"` Status []EngagementStatus `url:"status,omitempty"` ChannelID string `url:"channel_id,omitempty"` TriggerData map[string]interface{} `url:"-"` }
type GetObjectMessagesResponse ¶
type GetObjectMessagesResponse struct { Items []*ObjectMessage `json:"items"` PageInfo *PageInfo `json:"page_info"` }
type GetObjectPreferencesResponse ¶
type GetObjectPreferencesResponse struct {
Preferences *PreferenceSet
}
type GetObjectResponse ¶
type GetObjectResponse struct {
Object *Object
}
type GetObjectSchedulesRequest ¶ added in v0.1.6
type GetObjectSchedulesResponse ¶ added in v0.1.6
type GetObjectSubscriptionsRequest ¶ added in v0.1.8
type GetObjectSubscriptionsResponse ¶ added in v0.1.8
type GetObjectSubscriptionsResponse struct { Entries []*ObjectSubscription `json:"entries"` PageInfo *PageInfo `json:"page_info"` }
type GetTenantRequest ¶ added in v0.1.2
type GetTenantRequest struct {
ID string
}
type GetTenantResponse ¶ added in v0.1.2
type GetTenantResponse struct {
Tenant *Tenant
}
type GetUserChannelDataResponse ¶
type GetUserChannelDataResponse struct {
ChannelData map[string]interface{} `json:"data"`
}
type GetUserMessagesRequest ¶
type GetUserMessagesRequest struct { ID string `url:"-"` PageSize int `url:"page_size,omitempty"` After string `url:"after,omitempty"` Before string `url:"before,omitempty"` Source string `url:"source,omitempty"` Tenant string `url:"tenant,omitempty"` Status []EngagementStatus `url:"status,omitempty"` ChannelID string `url:"channel_id,omitempty"` TriggerData map[string]interface{} `url:"-"` }
type GetUserMessagesResponse ¶
type GetUserMessagesResponse struct {
Messages []*Message `json:"items"`
}
type GetUserPreferencesResponse ¶
type GetUserPreferencesResponse struct {
Preferences *PreferenceSet
}
type GetUserRequest ¶
type GetUserRequest struct {
ID string
}
type GetUserResponse ¶
type GetUserResponse struct {
User *User
}
type GetUserSchedulesRequest ¶ added in v0.1.6
type GetUserSchedulesResponse ¶ added in v0.1.6
type GetUserSubscriptionsRequest ¶ added in v0.1.8
type GetUserSubscriptionsResponse ¶ added in v0.1.8
type GetUserSubscriptionsResponse struct { Entries []*ObjectSubscription `json:"entries"` PageInfo *PageInfo `json:"page_info"` }
type IdentifyUserRequest ¶
type IdentifyUserRequest = User
type IdentifyUserResponse ¶
type IdentifyUserResponse = GetUserResponse
type ListMessagesRequest ¶
type ListMessagesRequest struct { PageSize int `url:"page_size,omitempty"` Before string `url:"before,omitempty"` After string `url:"after,omitempty"` Source string `url:"source,omitempty"` Tenant string `url:"tenant,omitempty"` Status []EngagementStatus `url:"status,omitempty"` ChannelID string `url:"channel_id,omitempty"` TriggerData map[string]interface{} `url:"-"` }
Client structs
type ListMessagesResponse ¶
type ListObjectsRequest ¶ added in v0.1.8
type ListObjectsResponse ¶ added in v0.1.8
type ListSchedulesRequest ¶ added in v0.1.6
type ListSchedulesRequest struct { PageSize int `url:"page_size,omitempty"` Cursor string `url:"cursor,omitempty"` Before string `url:"before,omitempty"` After string `url:"after,omitempty"` Workflow string `url:"workflow"` Tenant string `url:"tenant,omitempty"` Recipients []interface{} `url:"recipients,omitempty"` }
type ListSchedulesResponse ¶ added in v0.1.6
type ListSubscriptionsRequest ¶ added in v0.1.4
type ListSubscriptionsResponse ¶ added in v0.1.4
type ListSubscriptionsResponse struct { Entries []*ObjectSubscription `json:"entries"` PageInfo *PageInfo `json:"page_info"` }
type ListTenantsRequest ¶ added in v0.1.2
type ListTenantsRequest struct { PageSize int `url:"page_size,omitempty"` Before string `url:"before,omitempty"` After string `url:"after,omitempty"` TenantID string `url:"tenant_id,omitempty"` Name string `url:"name,omitempty"` }
Client structs
type ListTenantsResponse ¶ added in v0.1.2
type ListUsersRequest ¶ added in v0.1.10
type ListUsersRequest struct { PageSize int `url:"page_size,omitempty"` Before string `url:"before,omitempty"` After string `url:"after,omitempty"` }
Client structs
type ListUsersResponse ¶ added in v0.1.10
type MergeUserRequest ¶
type MergeUserResponse ¶
type MergeUserResponse = GetUserResponse
type Message ¶
type Message struct { Cursor string `json:"__cursor"` ID string `json:"id"` ChannelID string `json:"channel_id"` Recipient string `json:"recipient"` Workflow string `json:"workflow"` Tenant string `json:"tenant"` Status EngagementStatus `json:"status"` ReadAt time.Time `json:"read_at"` SeenAt time.Time `json:"seen_at"` ArchivedAt time.Time `json:"archived_at"` InsertedAt time.Time `json:"inserted_at"` UpdatedAt time.Time `json:"updated_at"` Source *NotificationSource `json:"source"` Data map[string]interface{} `json:"data"` }
type MessageActivity ¶
type MessageContent ¶
type MessageEvent ¶
type MessageStatus ¶
type MessageStatus string
const ( NotSent MessageStatus = "seen" Read MessageStatus = "read" Archived MessageStatus = "archived" Unarchived MessageStatus = "unarchived" Unread MessageStatus = "unread" )
type MessagesService ¶
type MessagesService interface { List(context.Context, *ListMessagesRequest) ([]*Message, *PageInfo, error) Get(context.Context, *GetMessageRequest) (*Message, error) GetEvents(context.Context, *GetMessageEventsRequest) ([]*MessageEvent, *PageInfo, error) GetActivities(context.Context, *GetMessageActivitiesRequest) ([]*MessageActivity, *PageInfo, error) GetContent(context.Context, *GetMessageContentRequest) (*MessageContent, error) SetStatus(context.Context, *SetStatusRequest) (*Message, error) DeleteStatus(context.Context, *DeleteStatusRequest) (*Message, error) BatchSetStatus(context.Context, *BatchSetStatusRequest) ([]*Message, error) BulkChangeChannelStatus(context.Context, *BulkChangeChannelStatusRequest) (*BulkOperation, error) }
MessagesService is an interface for communicating with the Knock Messages API endpoints.
type MethodOptions ¶ added in v0.1.5
type MethodOptions struct {
IdempotencyKey string
}
type NotificationSource ¶
type Object ¶
type Object struct { Collection string `json:"collection"` ID string `json:"id"` Properties map[string]interface{} `json:"properties"` UpdatedAt time.Time `json:"updated_at"` CreatedAt time.Time `json:"created_at"` }
Context structs
type ObjectMessage ¶
type ObjectMessage struct { Cursor string `json:"__cursor"` ID string `json:"id"` ChannelID string `json:"channel_id"` Recipient map[string]interface{} `json:"recipient"` Workflow string `json:"workflow"` Tenant string `json:"tenant"` Status EngagementStatus `json:"status"` ReadAt time.Time `json:"read_at"` SeenAt time.Time `json:"seen_at"` ArchivedAt time.Time `json:"archived_at"` InsertedAt time.Time `json:"inserted_at"` UpdatedAt time.Time `json:"updated_at"` Source *NotificationSource `json:"source"` Data map[string]interface{} `json:"data"` }
type ObjectSubscription ¶ added in v0.1.4
type ObjectsService ¶
type ObjectsService interface { Get(context.Context, *GetObjectRequest) (*Object, error) Set(context.Context, *SetObjectRequest) (*Object, error) BulkSet(context.Context, *BulkSetObjectsRequest) (*BulkOperation, error) Delete(context.Context, *DeleteObjectRequest) error BulkDelete(context.Context, *BulkDeleteObjectsRequest) (*BulkOperation, error) List(context.Context, *ListObjectsRequest) ([]*Object, *PageInfo, error) GetMessages(context.Context, *GetObjectMessagesRequest) ([]*ObjectMessage, *PageInfo, error) GetSchedules(context.Context, *GetObjectSchedulesRequest) ([]*Schedule, *PageInfo, error) GetSubscriptions(context.Context, *GetObjectSubscriptionsRequest) ([]*ObjectSubscription, *PageInfo, error) GetChannelData(context.Context, *GetObjectChannelDataRequest) (map[string]interface{}, error) SetChannelData(context.Context, *SetObjectChannelDataRequest) (map[string]interface{}, error) DeleteChannelData(context.Context, *DeleteObjectChannelDataRequest) error GetPreferences(context.Context, *GetObjectPreferencesRequest) (*PreferenceSet, error) SetPreferences(context.Context, *SetObjectPreferencesRequest) (*PreferenceSet, error) AddSubscriptions(context.Context, *AddSubscriptionsRequest) ([]*ObjectSubscription, error) BulkAddSubscriptions(context.Context, *BulkAddSubscriptionsRequest) (*BulkOperation, error) DeleteSubscriptions(context.Context, *DeleteSubscriptionsRequest) ([]*ObjectSubscription, error) ListSubscriptions(context.Context, *ListSubscriptionsRequest) (*ListSubscriptionsResponse, error) }
ObjectsService is an interface for communicating with the Knock Objects API endpoints.
type PreferenceSet ¶
type Schedule ¶ added in v0.1.6
type Schedule struct { Cursor string `json:"__cursor"` ID string `json:"id"` Recipient interface{} `json:"recipient"` Repeats []*ScheduleRepeat `json:"repeats"` Workflow string `json:"workflow"` Tenant string `json:"tenant"` LastOccurrenceAt time.Time `json:"last_occurrence_at"` NextOccurrenceAt time.Time `json:"next_occurrence_at"` InsertedAt time.Time `json:"inserted_at"` UpdatedAt time.Time `json:"updated_at"` Data map[string]interface{} `json:"data"` }
type ScheduleRepeat ¶ added in v0.1.6
type SetObjectChannelDataResponse ¶
type SetObjectChannelDataResponse = GetUserChannelDataResponse
type SetObjectPreferencesRequest ¶
type SetObjectPreferencesRequest struct { PreferenceID string `json:"-"` ObjectID string `json:"-"` Collection string `json:"-"` Workflows map[string]interface{} `json:"workflows,omitempty"` ChannelTypes map[string]interface{} `json:"channel_types,omitempty"` Categories map[string]interface{} `json:"categories,omitempty"` }
func (*SetObjectPreferencesRequest) AddCategoriesPreference ¶ added in v0.1.1
func (sr *SetObjectPreferencesRequest) AddCategoriesPreference(categories map[string]interface{}) SetObjectPreferencesRequest
func (*SetObjectPreferencesRequest) AddChannelTypesPreference ¶ added in v0.1.1
func (sr *SetObjectPreferencesRequest) AddChannelTypesPreference(channelType map[string]interface{}) SetObjectPreferencesRequest
func (*SetObjectPreferencesRequest) AddWorkflowsPreference ¶ added in v0.1.1
func (sr *SetObjectPreferencesRequest) AddWorkflowsPreference(workflows map[string]interface{}) SetObjectPreferencesRequest
type SetObjectPreferencesResponse ¶
type SetObjectPreferencesResponse = GetObjectPreferencesResponse
type SetObjectRequest ¶
type SetObjectResponse ¶
type SetObjectResponse = GetObjectResponse
type SetStatusRequest ¶
type SetStatusRequest struct { ID string Status MessageStatus }
type SetStatusResponse ¶
type SetStatusResponse = GetMessageResponse
type SetTenantRequest ¶ added in v0.1.2
type SetTenantResponse ¶ added in v0.1.2
type SetTenantResponse = GetTenantResponse
type SetUserChannelDataResponse ¶
type SetUserChannelDataResponse = GetUserChannelDataResponse
type SetUserPreferencesRequest ¶
type SetUserPreferencesRequest struct { UserId string `json:"-"` PreferenceID string `json:"-"` Workflows map[string]interface{} `json:"workflows,omitempty"` ChannelTypes map[string]interface{} `json:"channel_types,omitempty"` Categories map[string]interface{} `json:"categories,omitempty"` }
func (*SetUserPreferencesRequest) AddCategoriesPreference ¶ added in v0.1.1
func (sr *SetUserPreferencesRequest) AddCategoriesPreference(categories map[string]interface{}) SetUserPreferencesRequest
func (*SetUserPreferencesRequest) AddChannelTypesPreference ¶ added in v0.1.1
func (sr *SetUserPreferencesRequest) AddChannelTypesPreference(channelType map[string]interface{}) SetUserPreferencesRequest
func (*SetUserPreferencesRequest) AddWorkflowsPreference ¶ added in v0.1.1
func (sr *SetUserPreferencesRequest) AddWorkflowsPreference(workflows map[string]interface{}) SetUserPreferencesRequest
type SetUserPreferencesResponse ¶
type SetUserPreferencesResponse = GetUserPreferencesResponse
type Tenant ¶ added in v0.1.2
type Tenant struct { ID string `json:"id"` Properties map[string]interface{} `json:"properties"` Settings map[string]interface{} `json:"settings"` UpdatedAt time.Time `json:"updated_at"` CreatedAt time.Time `json:"created_at"` }
Context structs
type TenantsService ¶ added in v0.1.2
type TenantsService interface { List(context.Context, *ListTenantsRequest) ([]*Tenant, *PageInfo, error) Get(context.Context, *GetTenantRequest) (*Tenant, error) Set(context.Context, *SetTenantRequest) (*Tenant, error) Delete(context.Context, *DeleteTenantRequest) error }
TenantsService is an interface for communicating with the Knock Tenants API endpoints.
type TriggerWorkflowRequest ¶
type TriggerWorkflowRequest struct { Workflow string `json:"workflow"` Recipients []interface{} `json:"recipients"` Actor interface{} `json:"actor,omitempty"` CancellationKey string `json:"cancellation_key,omitempty"` Tenant interface{} `json:"tenant,omitempty"` Data map[string]interface{} `json:"data,omitempty"` }
Client structs
func (*TriggerWorkflowRequest) AddActorByEntity ¶ added in v0.1.1
func (tr *TriggerWorkflowRequest) AddActorByEntity(entity map[string]interface{}) TriggerWorkflowRequest
func (*TriggerWorkflowRequest) AddActorByID ¶ added in v0.1.1
func (tr *TriggerWorkflowRequest) AddActorByID(actorID string) TriggerWorkflowRequest
func (*TriggerWorkflowRequest) AddRecipientByEntity ¶ added in v0.1.1
func (tr *TriggerWorkflowRequest) AddRecipientByEntity(entity map[string]interface{}) TriggerWorkflowRequest
func (*TriggerWorkflowRequest) AddRecipientByID ¶ added in v0.1.1
func (tr *TriggerWorkflowRequest) AddRecipientByID(recipientID string) TriggerWorkflowRequest
func (*TriggerWorkflowRequest) AddTenantByEntity ¶ added in v0.1.14
func (tr *TriggerWorkflowRequest) AddTenantByEntity(entity map[string]interface{}) TriggerWorkflowRequest
func (*TriggerWorkflowRequest) AddTenantByID ¶ added in v0.1.14
func (tr *TriggerWorkflowRequest) AddTenantByID(tenantID string) TriggerWorkflowRequest
type TriggerWorkflowResponse ¶
type TriggerWorkflowResponse struct {
WorkflowRunId string `json:"workflow_run_id"`
}
type UpdateSchedulesRequest ¶ added in v0.1.6
type UpdateSchedulesRequest struct { ScheduleIDs []string `json:"schedule_ids"` Repeats []*ScheduleRepeat `json:"repeats"` Actor interface{} `json:"actor,omitempty"` Tenant interface{} `json:"tenant,omitempty"` ScheduledAt time.Time `json:"scheduled_at,omitempty"` Data map[string]interface{} `json:"data,omitempty"` }
func (*UpdateSchedulesRequest) AddActorByEntity ¶ added in v0.1.6
func (usr *UpdateSchedulesRequest) AddActorByEntity(entity map[string]interface{}) UpdateSchedulesRequest
func (*UpdateSchedulesRequest) AddActorByID ¶ added in v0.1.6
func (usr *UpdateSchedulesRequest) AddActorByID(actorID string) UpdateSchedulesRequest
func (*UpdateSchedulesRequest) AddRepeat ¶ added in v0.1.6
func (usr *UpdateSchedulesRequest) AddRepeat(repeat *ScheduleRepeat) UpdateSchedulesRequest
func (*UpdateSchedulesRequest) AddTenantByEntity ¶ added in v0.1.14
func (usr *UpdateSchedulesRequest) AddTenantByEntity(entity map[string]interface{}) UpdateSchedulesRequest
func (*UpdateSchedulesRequest) AddTenantByID ¶ added in v0.1.14
func (usr *UpdateSchedulesRequest) AddTenantByID(tenantID string) UpdateSchedulesRequest
type UsersService ¶
type UsersService interface { List(context.Context, *ListUsersRequest) ([]*User, *PageInfo, error) Get(context.Context, *GetUserRequest) (*User, error) Identify(context.Context, *IdentifyUserRequest) (*User, error) Merge(context.Context, *MergeUserRequest) (*User, error) Delete(context.Context, *DeleteUserRequest) error GetMessages(context.Context, *GetUserMessagesRequest) ([]*Message, error) GetSchedules(context.Context, *GetUserSchedulesRequest) ([]*Schedule, *PageInfo, error) GetSubscriptions(context.Context, *GetUserSubscriptionsRequest) ([]*ObjectSubscription, *PageInfo, error) BulkIdentify(context.Context, *BulkIdentifyUserRequest) (*BulkOperation, error) BulkDelete(context.Context, *BulkDeleteUserRequest) (*BulkOperation, error) GetFeed(context.Context, *GetFeedRequest) (*Feed, error) GetChannelData(context.Context, *GetUserChannelDataRequest) (map[string]interface{}, error) SetChannelData(context.Context, *SetUserChannelDataRequest) (map[string]interface{}, error) DeleteChannelData(context.Context, *DeleteUserChannelDataRequest) error GetAllPreferences(context.Context, *GetAllPreferencesRequest) ([]*PreferenceSet, error) GetPreferences(context.Context, *GetUserPreferencesRequest) (*PreferenceSet, error) SetPreferences(context.Context, *SetUserPreferencesRequest) (*PreferenceSet, error) BulkSetPreferences(context.Context, *BulkSetUserPreferencesRequest) (*BulkOperation, error) }
UsersService is an interface for communicating with the Knock Users API endpoints.
type WorkflowsService ¶
type WorkflowsService interface { Trigger(context.Context, *TriggerWorkflowRequest, *MethodOptions) (string, error) Cancel(context.Context, *CancelWorkflowRequest) error CreateSchedules(context.Context, *CreateSchedulesRequest) ([]*Schedule, error) UpdateSchedules(context.Context, *UpdateSchedulesRequest) ([]*Schedule, error) DeleteSchedules(context.Context, *DeleteSchedulesRequest) ([]*Schedule, error) ListSchedules(context.Context, *ListSchedulesRequest) ([]*Schedule, *PageInfo, error) }
WorkflowsService is an interface for communicating with the Knock Workflows API endpoints.