UNPKG

zendesk-messaging-client

Version:
1,079 lines (1,078 loc) 40.9 kB
// This file is auto-generated by @hey-api/openapi-ts import { formDataBodySerializer, } from './client'; /** * List Apps * Lists all apps that a user is part of. This API is paginated through [cursor pagination](#section/Introduction/API-pagination-and-records-limits). * ```shell * /v2/apps?page[after]=5e1606762556d93e9c176f69&page[size]=10 * ``` * */ export const listApps = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps' }, options)); }; /** * Create App * Creates a new app. When using [service account](#service-accounts) credentials, the service account is automatically granted access to the app. */ export const createApp = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Delete App * Removes the specified app, including all its enabled integrations. */ export const deleteApp = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}' }, options)); }; /** * Get App * Fetches an individual app. */ export const getApp = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}' }, options)); }; /** * Update App * Updates an app. */ export const updateApp = (options) => { return options.client.patch(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * List App Keys * Lists all API keys for a given app. */ export const listAppKeys = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/keys' }, options)); }; /** * Create App Key * Creates an API key for the specified app. The response body will include a secret * as well as its corresponding id, which you can use to generate JSON Web Tokens to * securely make API calls on behalf of the app. * */ export const createAppKey = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/keys' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Delete App Key * Removes an API key. */ export const deleteAppKey = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/keys/{keyId}' }, options)); }; /** * Get App Key * Returns an API key. */ export const getAppKey = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/keys/{keyId}' }, options)); }; /** * Upload Attachment * Upload an attachment to Sunshine Conversations to use in future messages. Files are uploaded using the multipart/form-data content type. Use the returned mediaUrl to send a file, image or carousel message. * <aside class="notice">Note that Sunshine Conversations limits the size and type of file you can upload to the platform. See the <a href="https://docs.smooch.io/guide/validating-files">file validation</a> guide for more details.</aside> * */ export const uploadAttachment = (options) => { return options.client.post(Object.assign(Object.assign(Object.assign(Object.assign({}, formDataBodySerializer), { security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/attachments' }), options), { headers: Object.assign({ 'Content-Type': null }, options.headers) })); }; /** * Delete Attachment * Remove an attachment uploaded to Sunshine Conversations through the Upload attachment API. * See [Attachments for Messages](#section/Attachments-for-Messages) to have attachments automatically deleted when deleting messages, conversations or users. * <aside class="notice">Note that deleted attachments can remain available on our CDN’s cache up to 15 minutes after the delete call.</aside> * */ export const deleteAttachment = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/attachments/remove' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * List Conversations * Lists all conversations that a user is part of. This API is paginated through [cursor pagination](#section/Introduction/API-pagination-and-records-limits). * ```shell * /v2/apps/:appId/conversations?filter[userId]=42589ad070d43be9b00ff7e5 * ``` * */ export const listConversations = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations' }, options)); }; /** * Create Conversation * Create a conversation for the specified user(s). */ export const createConversation = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Delete Conversation * Delete an entire conversation record, along with its messages and attachments. Note that the default conversation cannot be deleted, but the messages contained [can be](#deleteAllMessages). */ export const deleteConversation = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}' }, options)); }; /** * Get Conversation * Fetches an individual conversation. */ export const getConversation = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}' }, options)); }; /** * Update Conversation * Updates a conversation record. */ export const updateConversation = (options) => { return options.client.patch(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Join Conversation * Adds a user to a conversation using either their userId or userExternalId. The endpoint only * supports adding a participant to a sdkGroup conversation. * */ export const joinConversation = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}/join' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * List Participants * Lists all the participants of a particular conversation. This API is paginated through [cursor pagination](#section/Introduction/API-pagination-and-records-limits). * * ```shell * /v2/apps/:appId/conversations/:conversationId/participants?page[before]=26508c10541a4b0ff472e5e2 * ``` * */ export const listParticipants = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}/participants' }, options)); }; /** * Leave Conversation * Removes a user from a conversation using either their userId, userExternalId, or participantId. * */ export const leaveConversation = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}/leave' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Delete All Messages * Delete all messages of a particular conversation. */ export const deleteAllMessages = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}/messages' }, options)); }; /** * List Messages * List all messages for a particular conversation. This API is paginated through * [cursor pagination](#section/Introduction/API-pagination-and-records-limits), in the _backwards_ direction, with the * most recent (i.e. last) page of messages being returned by default. The `hasMore` flag indicates whether more messages * exist in the direction you are currently paginating through. To page backwards in the history, use the `beforeCursor` or follow the `prev` * link. The page size limit is fixed at 100 messages per page. * * ```shell * /v2/apps/:appId/conversations/:conversationId/messages?page[before]=5f32b88acf6bf25073b2be56 * ``` * */ export const listMessages = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}/messages' }, options)); }; /** * Post Message * Send a message in a particular conversation. */ export const postMessage = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}/messages' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Delete Message * Delete a single message of a particular conversation. */ export const deleteMessage = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}/messages/{messageId}' }, options)); }; /** * Post Activity * Notify Sunshine Conversations of different conversation activities. Supported activity types are: * * Typing activity * * Conversation read event * */ export const postActivity = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}/activity' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Accept Control * The acceptControl action transfers the control of the conversation to the pending switchboard integration. When using integration auth scope, a 403 is returned if the pending switchboard integration is not the authenticated integration. */ export const acceptControl = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}/acceptControl' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Offer Control * The offerControl action will invite a switchboard integration to accept control of the conversation (changing its status to pending), and trigger a webhook signal to that integration indicating that they have been offered control of the conversation. Invalidates previous offerControl actions. */ export const offerControl = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}/offerControl' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Pass Control * The passControl action marks the named switchboard integration as active and transitions all the other switchboard integrations to standby status. The `passControl` action is idempotent if either the target `switchboardIntegration` is specified explicitly by its `id` or `name`, or the `next` keyword is used for the `switchboardIntegration` field, and the invoking integration can be identified by its [OAuth token](https://docs.smooch.io/guide/oauth/#redirect-and-acquiring-an-oauth-token) or [Custom Integration API Key](https://docs.smooch.io/rest/#tag/CustomIntegrationApiKeys) credentials. Duplicate passControl actions using the `next` keyword and their metadata are disregarded. For more information, see [Switchboard passControl](https://docs.smooch.io/guide/switchboard/#pass-control). */ export const passControl = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}/passControl' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Release Control * The releaseControl action releases the control of the conversation by nullifying its switchboard state. When using integration auth scope, a 403 is returned if the active switchboard integration is not the authenticated integration. */ export const releaseControl = (options) => { return options.client.post(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}/releaseControl' }, options)); }; /** * Download Message Ref * When a third party channel provides a reference of a data, this API can be used to download the reference and fetch the full data. Currently, only apple channel is supported. */ export const downloadMessageRef = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/conversations/{conversationId}/download' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * List Integrations * List available integrations. This API is paginated through [cursor pagination](#section/Introduction/API-pagination-and-records-limits). * ```shell * /v2/apps/:appId/integrations?page[after]=5e1606762556d93e9c176f69&page[size]=10&filter[types]=custom,web * ``` * */ export const listIntegrations = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations' }, options)); }; /** * Create Integration * The Create Integration endpoint allows you to provision apps with front-end messaging channels. Selecting a `custom` integration allows the creation of webhooks. */ export const createIntegration = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Delete Integration * Delete the specified integration. */ export const deleteIntegration = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations/{integrationId}' }, options)); }; /** * Get Integration * Get integration. */ export const getIntegration = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations/{integrationId}' }, options)); }; /** * Update Integration * Allows you to update certain fields of existing integrations. If updating a specific property is not supported, you must delete the integration and re-create it with the new data. */ export const updateIntegration = (options) => { return options.client.patch(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations/{integrationId}' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * List Integration Keys * Lists all API keys for a given integration. */ export const listCustomIntegrationKeys = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations/{integrationId}/keys' }, options)); }; /** * Create Integration Key * Creates an API key for the specified custom integration. The response body will include a secret as well it’s corresponding id, which you can use to generate JSON Web Tokens to securely make API calls on behalf of the integration. */ export const createCustomIntegrationKey = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations/{integrationId}/keys' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Delete Integration Key * Removes an API key. */ export const deleteCustomIntegrationKey = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations/{integrationId}/keys/{keyId}' }, options)); }; /** * Get Integration Key * Get the specified API key. */ export const getCustomIntegrationKey = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations/{integrationId}/keys/{keyId}' }, options)); }; /** * List Webhooks * Lists all webhooks for a given Sunshine Conversations Connect integration or custom integration. */ export const listWebhooks = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations/{integrationId}/webhooks' }, options)); }; /** * Create Webhook * Creates a new webhook associated with a Sunshine Conversations Connect integration or a custom integration. */ export const createWebhook = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations/{integrationId}/webhooks' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Delete Webhook * Deletes the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration. */ export const deleteWebhook = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId}' }, options)); }; /** * Get Webhook * Gets the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration. */ export const getWebhook = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId}' }, options)); }; /** * Update Webhook * Updates the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration. */ export const updateWebhook = (options) => { return options.client.patch(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId}' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * List Switchboards * Lists all switchboards belonging to the app. * */ export const listSwitchboards = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/switchboards' }, options)); }; /** * Create Switchboard * Create a switchboard. */ export const createSwitchboard = (options) => { return options.client.post(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/switchboards' }, options)); }; /** * Delete Switchboard * Deletes the switchboard and all its switchboard integrations. The integrations linked to these switchboard integrations are not deleted and will start receiving all conversation events. */ export const deleteSwitchboard = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/switchboards/{switchboardId}' }, options)); }; /** * Update Switchboard * Updates a switchboard record. */ export const updateSwitchboard = (options) => { return options.client.patch(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/switchboards/{switchboardId}' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * List Switchboard Integrations * Lists all switchboard integrations linked to the switchboard. * */ export const listSwitchboardIntegrations = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations' }, options)); }; /** * Create Switchboard Integration * Create a switchboard integration. */ export const createSwitchboardIntegration = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Delete Switchboard Integration * Deletes the switchboard integration. If the deleted switchboard integration had an active status for some conversations, the default switchboard integration will replace it. Note that it is forbidden to delete a switchboard integration if it's the default one (a new one must be chosen first) or if another switchboard integration's `nextSwitchboardIntegrationId` refers to it. The integration that was linked to the deleted switchboard integration will start receiving all conversation events, regardless of the switchboard status. */ export const deleteSwitchboardIntegration = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId}' }, options)); }; /** * Update Switchboard Integration * Updates a switchboard integration record. */ export const updateSwitchboardIntegration = (options) => { return options.client.patch(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId}' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Create User * Creates a new user. */ export const createUser = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/users' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Delete User * Delete a user, its clients and its conversation history. The user is considered completely deleted once the `user:delete` webhook is fired. To only delete a user’s personal information, see [Delete User Personal Information](#operation/deleteUserPersonalInformation). */ export const deleteUser = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/users/{userIdOrExternalId}' }, options)); }; /** * Get User * Fetches an individual user. */ export const getUser = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/users/{userIdOrExternalId}' }, options)); }; /** * Update User * Updates a user. */ export const updateUser = (options) => { return options.client.patch(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/users/{userIdOrExternalId}' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * List Clients * Get all the clients for a particular user, including both linked clients and pending clients. * This API is paginated through [cursor pagination](#section/Introduction/API-pagination-and-records-limits). * * ```shell * /v2/apps/:appId/users/:userId/clients?page[after]=5ebee0975ac5304b664a12fa * ``` * */ export const listClients = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/users/{userIdOrExternalId}/clients' }, options)); }; /** * Create Client * Create a client and link it to a channel specified by the `matchCriteria.type`. Note that the client is initially created with a `pending` status. The status of the linking request can be tracked by listening to the `link:match`, `link:success` and `link:failure` webhooks (only available in v1). For more information, see [link-events](https://docs.smooch.io/rest/v1/#link-events). */ export const createClient = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/users/{userIdOrExternalId}/clients' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Remove Client * Remove a particular client and unsubscribe it from all connected conversations. */ export const removeClient = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/users/{userIdOrExternalId}/clients/{clientId}' }, options)); }; /** * List Devices * Get all the devices for a particular user. * The Devices are sorted based on last seen time. * */ export const listDevices = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/users/{userIdOrExternalId}/devices' }, options)); }; /** * Get Device * Fetches a specific Device. * */ export const getDevice = (options) => { return options.client.get(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/users/{userIdOrExternalId}/devices/{deviceId}' }, options)); }; /** * Delete User Personal Information * Delete a user’s personal information. Calling this API will clear `givenName`, `surname`, `email` and `avatarUrl` and every custom property for the specified user. For every client owned by the user, it will also clear `displayName`, `avatarUrl` and any channel specific information stored in the info and raw fields. Calling this API doesn’t delete the user’s conversation history. To fully delete the user, see [Delete User](#operation/deleteUser). */ export const deleteUserPersonalInformation = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/users/{userIdOrExternalId}/personalinformation' }, options)); }; /** * Synchronize User * Synchronize a messaging user with its core Zendesk user counterpart. Messaging users are separate objects linked to a core Zendesk user record by `zendeskId`. It is possible for changes to be made to the core Zendesk user record in a way that causes the messaging user to fall out of sync. The core Zendesk user might have their primary email changed, for example. This endpoint can be used to update the messaging user with the `profile.givenName`, `profile.surname`, `externalId`, and primary email identity of its core Zendesk user counterpart.<br/><br/>It is also possible for two Zendesk users to be merged. In such a case, this API can be used to apply that merger on the messaging side. The surviving Zendesk user id can be specified via the `survivingZendeskId` parameter of the request body, and the outgoing `zendeskId` is specified in the request path. * <aside class="notice">Only the primary email identity of the core Zendesk user will be synchronized, and it will be set on the identities array, not in the profile.</aside> <br/> <aside class="notice">In some circumstances, a single call to this API might produce changes on more than one messaging user. If the externalId or email being synchronized already exists on a different messaging user within the account, the conflict will be resolved by merging those messaging users together, if possible. If a conflicting messaging user is already linked to a core Zendesk user by zendeskId it cannot be merged. In this case, the conflicting externalId or email will instead be removed and reassigned to the messaging user that is being synchronized.</aside> */ export const syncUser = (options) => { return options.client.post(Object.assign(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/v2/apps/{appId}/users/{zendeskId}/sync' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Authorize * This endpoint begins the OAuth flow. It relies on a browser session for authentication. If the user is not logged in to Sunshine Conversations they will be redirected to the login page. If the user has many apps, they will first be prompted to select the one they wish to integrate with. They will then be presented with an Allow/Deny dialog, describing details of the access your integration is requesting. */ export const authorize = (options) => { return options.client.get(Object.assign({ url: '/oauth/authorize' }, options)); }; /** * Get Token * This endpoint is used to exchange an authorization code for an access token. It should only be used in server-to-server calls. */ export const getToken = (options) => { return options.client.post(Object.assign(Object.assign({ url: '/oauth/token' }, options), { headers: Object.assign({ 'Content-Type': 'application/json' }, options.headers) })); }; /** * Revoke Access * This endpoint is used to revoke your integration’s access to the user’s Sunshine Conversations app. Revoking access means your integration will no longer be able to interact with the app, and any webhooks the integration had previously configured will be removed. * Calling this endpoint is equivalent to the user removing your integration manually in the Sunshine Conversations web app. Your integration’s `removeUrl` (if configured) will also be called when an integration is removed in this way. * */ export const revokeAccess = (options) => { return options.client.delete(Object.assign({ security: [ { scheme: 'basic', type: 'http', }, { scheme: 'bearer', type: 'http', }, ], url: '/oauth/authorization' }, options)); };